wifi speed code example
Example 1: how to test wifi speed py
>>> import pyspeedtest
>>> st = pyspeedtest.SpeedTest()
>>> st.ping()
9.306252002716064
>>> st.download()
42762976.92544772
>>> st.upload()
19425388.307319913
Example 2: wifi test
If you are reading this your wifi is working
Example 3: how to test wifi speed py
$ pyspeedtest -h
usage: pyspeedtest [OPTION]...
Test your bandwidth speed using Speedtest.net servers.
optional arguments:
-d L, --debug L set http connection debug level (default is 0)
-m M, --mode M test mode: 1 - download
2 - upload
4 - ping
1 + 2 + 4 = 7 - all (default)
-r N, --runs N use N runs (default is 2)
-s H, --server H use specific server
-v, --verbose output additional information
--version show program's version number and exit
Example 4: speed test
const string tempfile = "tempfile.tmp";
System.Net.WebClient webClient = new System.Net.WebClient();
Console.WriteLine("Downloading file....");
System.Diagnostics.Stopwatch sw = System.Diagnostics.Stopwatch.StartNew();
webClient.DownloadFile("http://dl.google.com/googletalk/googletalk-setup.exe", tempfile);
sw.Stop();
System.IO.FileInfo fileInfo = new System.IO.FileInfo(tempfile);
long speed = fileInfo.Length / sw.Elapsed.Seconds;
Console.WriteLine("Download duration: {0}", sw.Elapsed);
Console.WriteLine("File size: {0}", fileInfo.Length.ToString("N0"));
Console.WriteLine("Speed: {0} bps ", speed.ToString("N0"));
Console.WriteLine("Press any key to continue...");
Console.ReadLine();
Example 5: wifi tester
I had problems with WiFi now you do!! Unlucky.