Ping it? VB code. Some may have better code or a better solution. I use this in production to check if a wireless printer is "awake" or "asleep"
Private Shared Function Ping(ByVal IP As String) As Boolean Dim pingSender As New System.Net.NetworkInformation.Ping Dim pingOptions As New System.Net.NetworkInformation.PingOptions pingOptions.DontFragment = True Dim data As String = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaara" Dim buffer As Byte() = System.Text.Encoding.ASCII.GetBytes(data) Dim timeout As Integer = 240 Dim pingReply As System.Net.NetworkInformation.PingReply = pingSender.Send(IP, timeout, buffer, pingOptions) If pingReply.Status = Net.NetworkInformation.IPStatus.Success Then Return True Else Return False End If End Function On Tue, Nov 25, 2008 at 11:13 AM, Lianghua <[EMAIL PROTECTED]> wrote: > > I know that we can use HttpWebRequest to try to get the response, but > most of time, when the URL is not available, I need wait for a timeout > or 404 error. Is there any other way to complete this? Specially I > need a quick way to do so, instead of waiting for time out? > > thanks. > > Leon -- _______________________________ Take care, Paul It is not we non-interventionists who are isolationists. The real isolationists are those who impose sanctions and embargos on countries and peoples across the globe and who choose to use force overseas to promote democracy. A counterproductive approach that actually leads the U.S. to be more resented and more isolated in the world. Dr. Ron Paul www.RonPaul2008.com
