J
Johan
Hi
I'm working with sockets and I'm curious about the timout when trying to
connect to a server on a specific port.
My code looks like this:
Socket client = new
Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp);
int port = Int32.Parse( TextBox_Port.Text );
string ip = TextBox_IP.Text;
ipAdd = IPAddress.Parse( ip );
remoteEP = new IPEndPoint ( ipAdd, port );
client.Connect (remoteEP);
What I can't get a grip on is the long timout period if the server does not
respond.
I've tried adding:
client.SetSocketOption(SocketOptionLevel.Socket,
SocketOptionName.SendTimeout, 500);
client.SetSocketOption(SocketOptionLevel.Socket,
SocketOptionName.SendTimeout, 500);
but this does not help...
Is there a way of controling the timeout on connect?
/Johan
I'm working with sockets and I'm curious about the timout when trying to
connect to a server on a specific port.
My code looks like this:
Socket client = new
Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp);
int port = Int32.Parse( TextBox_Port.Text );
string ip = TextBox_IP.Text;
ipAdd = IPAddress.Parse( ip );
remoteEP = new IPEndPoint ( ipAdd, port );
client.Connect (remoteEP);
What I can't get a grip on is the long timout period if the server does not
respond.
I've tried adding:
client.SetSocketOption(SocketOptionLevel.Socket,
SocketOptionName.SendTimeout, 500);
client.SetSocketOption(SocketOptionLevel.Socket,
SocketOptionName.SendTimeout, 500);
but this does not help...
Is there a way of controling the timeout on connect?
/Johan