Hi,
Your codes seem to be right. And the
ConnectAsync(HostName, String) method throws an exception if a TCP connection could not be established with the network server. So if the connection established successfully,you cannot catch the exceptions. You can see Connecting
with a stream socket to get more information.
Best Wishes!
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. Thanks<br/> MSDN Community Support<br/> <br/> Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and
makes it easier for other visitors to find the resolution later.