Problem with sockets in C#

Posted by depo on Stack Overflow See other posts from Stack Overflow or by depo
Published on 2009-03-30T19:34:52Z Indexed on 2010/03/17 11:41 UTC
Read the original article Hit count: 134

Filed under:
|
Socket socket = new Socket(ipe.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
...
socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout, 1000);
...
socket.Send(bytesSent, bytesSent.Length, 0);
...
bytes = socket.Receive(bytesReceived, bytesReceived.Length, 0);

After socket has sent the data, server does not respond so that program waits for response. How to stop receiving data after 1000 miliseconds? ?

© Stack Overflow or respective owner

Related posts about c#

Related posts about socket