Ping and Open Port

larnauth

Newcomer
Joined
Dec 6, 2003
Messages
1
Hello all,

How do i check if a server is alive (ping response is acceptable) and if a service is running (an open port - 21 ftp, 1433 mssql, etc it's also ok).

Can i do this in VB.NET or C# ?

Thank you,

Luis Arnauth
 
For the ping, you'd need to lookup the specs for that. I'm sorry I can't help you there. Try looking for RFC and 'ICMP echo' in google. I know people have created a published programs that can ping in .net.

For detecting a service though, the easiest way would probably be to create a TcpClient and connect to the IP and the port of the service. If an exception is thrown, the service probably doesn't exist on the specified IP.
 
Back
Top