How to check for port response

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I understand how easy it is to use the my.computer.network.ping command, but
is it as easy to check for a response on a given port?

How can I check for a response for port x at 123.456.789?
 
for response ?




if you mean to check if a port is open or not


Imports System.Net.Sockets

Private Function TCP_Port_Open(ByVal ip As String, ByVal port As Integer) As
Boolean

Dim TcpPortscan As New TcpClient

Try

'Try to connect

TcpPortscan.Connect(ip, port)

' we are still here :-) so this port is asumed open

Return True

Finally

TcpPortscan.Close()

End Try

End Function

regards



Michel Posseth [MCP]
 

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

Back
Top