Click here to Skip to main content
15,917,709 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi everyone!
I want to create a tcp client using System.Net.Sockets.Socket class to make a new connection to a remote host

C#
Socket _client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

try
{
    _client.Connect(IPAddress.Parse("193.89.90.21"), 9000);
}
catch(SocketException)
{
    //blah - blah -blah--
}


I want to figure out how to set the connection timeout and what time should elapsed to notify that there is no chance to connect???
How to use Socket.Poll() method properly to test whether the connection could be ever established???
Posted
Updated 27-Jun-10 11:26am
v2

1 solution

Have a look at this[^] example on how to use Socket.Poll.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900