Friday, 17 September 2010

How to check a particular server exists and port is open

I had a requirement to relay emails via an SMTP server in one of my applications. This was not too hard to implement but a few users were not getting the server details correct and there was no way of checking if the details were valid when entering the details.

I used the code below to check if the server existed and the port was open by using the TcpClient class in the .Net framework.

No comments:

Post a Comment