> How can i write a simple bandwidth tester with Python? It's very simple in concept: just download a fixed quantity of data and measure how long it took. Unfortunately, like many concepts measuring true Bandwidth is much more complex than that!
The simple approach only works if: 1) You are the only user of the link 2) You are the only user of the server at the other end 3) The remote server has 'infinite' capacity to deliver data. 4) The receiving computer has infinite capacity to receive data. 5) The data you receive is much bigger than the network protocol overhead 6) The data you receive is all delivered in a single packet If you can meet all of the above (or get near enough) then a simple approach will work. Otherwise you need to take account of queuing effects, both in the link and in the server, packet delays and network overheads. One way of achieveing resonable results is to repeat the process several times and take an average. Another thing to consider is taking a few ping samples and subtracting the ping time (multiplied by the number of packets) from the total. However, many people when they refer to Bandwidth really mean the available data throughput which is much easier to measure. The simple approach combined with averaging is usually adequate for that (but still beware of factor 2 in the list above). Finally, these techniques will only give a figure for the throughput of the end to end link, not the bandwidth of your ISP connection. To achieve that you need to ensure you download the data from a server on the same LAN as your network server! If you try using a remote server the congestion on a link between the USA and Europe, say, could easily become a dominant factor for the duration of your measures but on another occasion be non affecting. To get round that you need to take your samples at widely different times of day and day of week/month.... HTH Alan G Author of the Learn to Program web tutor http://www.freenetpages.co.uk/hp/alan.gauld _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor