Checking Site Status ?

  • Thread starter Thread starter T :-\)
  • Start date Start date
T

T :-\)

hi,

I have a list of URL's which i would like to check if they are response
(return 200 OK).

what is the best way to do that ?

Thanks,

T;-)
 
Try:

Dim objTcpClient As System.Net.Sockets.TcpClient
Dim objNetworkStream As System.Net.Sockets.NetworkStream
Dim iBytesCount As Integer
Dim objBuffer(2000) As Byte
Dim sData As String


Try

objTcpClient = New System.Net.Sockets.TcpClient

objTcpClient.Connect("pop.mail.yahoo.com", 110) // your data
here

objNetworkStream = DirectCast(objTcpClient.GetStream(),
System.Net.Sockets.NetworkStream)
iBytesCount = objNetworkStream.Read(objBuffer, 0,
objBuffer.Length)

If iBytesCount > 0 Then
sData = System.Text.Encoding.ASCII.GetString(objBuffer)
MessageBox.Show(sData)
End If

Catch objException As Exception

MessageBox.Show(objException.GetBaseException.ToString)

Finally

If Not (objNetworkStream Is Nothing) Then
objNetworkStream.Close()
End If

If Not (objTcpClient Is Nothing) Then
objTcpClient.Close()
End If

End Try
 
Thanks.

Carlos J. Quintero said:
Try:

Dim objTcpClient As System.Net.Sockets.TcpClient
Dim objNetworkStream As System.Net.Sockets.NetworkStream
Dim iBytesCount As Integer
Dim objBuffer(2000) As Byte
Dim sData As String


Try

objTcpClient = New System.Net.Sockets.TcpClient

objTcpClient.Connect("pop.mail.yahoo.com", 110) // your data
here

objNetworkStream = DirectCast(objTcpClient.GetStream(),
System.Net.Sockets.NetworkStream)
iBytesCount = objNetworkStream.Read(objBuffer, 0,
objBuffer.Length)

If iBytesCount > 0 Then
sData = System.Text.Encoding.ASCII.GetString(objBuffer)
MessageBox.Show(sData)
End If

Catch objException As Exception

MessageBox.Show(objException.GetBaseException.ToString)

Finally

If Not (objNetworkStream Is Nothing) Then
objNetworkStream.Close()
End If

If Not (objTcpClient Is Nothing) Then
objTcpClient.Close()
End If

End Try


--

Carlos J. Quintero (Visual Developer - .NET MVP)

The MZ-Tools all-in-one add-in, now for .NET: http://www.mztools.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Access Validation rule in MS access 2010 1
Excel VBA 1
RealWear Headset 0
Not receiving forum emails 14
Access It's time for your check-in. 1
WMI - Win32_LogicalDisk - Status 0
Screen Scraping a Password Protected Site 3
Are my CPU temps normal? 1

Back
Top