tags:

views:

41

answers:

2

I am using VB.net to ping a domain/IP, using the following code;

My.Computer.Network.Ping(Address, 1000)

I now want to add a port to the domain/IP - e.g google.co.uk:21

How would I go about this?

+4  A: 

You cannot ping a port but you can try to connect to a specific port using either TCP/IP or UDP. The port concept belongs to the transport layer of the protocol stack (either TCP or UDP) while the ping is at the lower network layer (the ICMP protocol).

Martin Liversage
Ahh thanks for your help, I prefer to code and GUI design, and have no sense of TCP/IP etc. Thank you Stack Overflow!!
Connnnoorr
+2  A: 

You don't, because that's not how ping works. There's no concept of a port in the ICMP protocol.

If you want to see if a port is open on a server, you must attempt to connect to it using TCP or UDP (depending on the protocol expected for that server). There's no other way to check for an open port.

Michael Madsen