Bandwidth Leak? Please check.


Well-known member
Jun 3, 2004
Programming Experience
Hi, I wrote an Internet connection status program to run on my server, and alert me when the internet became disconnected. It was probably just a coincidence, but the month that I tested it, I went way over my internet bandwidth cap. Can someone please just have a quick look over this code and tell me if there is a bandwidth leak?

When it runs it uses about 0.3% of the network, for less then a second. So I don’t see how it could be using the bandwidth. I probably just downloaded too much that month, but none the less. Is anything wrong with this?

[size=2][color=#008000]'Check Web Connection[/color][/size]
[size=2][color=#0000ff]Dim[/color][/size][size=2] WebRequest [/size][size=2][color=#0000ff]As[/color][/size][size=2] System.Net.WebRequest[/size]
[size=2][color=#008000]' Initialize the WebRequest.
[/color][/size][size=2][color=#0000ff]Dim[/color][/size][size=2] myRequest [/size][size=2][color=#0000ff]As[/color][/size][size=2] System.Net.WebRequest = WebRequest.Create([url=""][/url])[/size]
[size=2][color=#008000]' Return the response. [/color][/size]
[size=2][color=#0000ff]Dim[/color][/size][size=2] myResponse [/size][size=2][color=#0000ff]As[/color][/size][size=2] System.Net.WebResponse = myRequest.GetResponse()[/size]
[size=2][color=#008000]' Code to use the WebResponse goes here.[/color][/size]
[size=2][color=#008000]' Close the response to free resources.[/color][/size]
[/size][size=2][color=#0000ff]Catch[/color][/size][size=2] ex [/size][size=2][color=#0000ff]As[/color][/size][size=2] Exception[/size]
[size=2][color=#008000]' The Web request failed. Use code here.[/color][/size]
I got the code out of the MSDN library, i put my own code for a failed connection, and the WebResponse code.
It attemtps a connection every 10 minutes, and uses a progress bar for the timer.
Thanks for your time,

Latest posts