TCP data not sent or received !
I am developing a c# network application using TCP sockets. I am using different threads (each thread with its own socket). I notice that when the number of threads increase, some sent data using Socket.Send(...) function is not received on the other side. I use socket.avaialable property to check if there is data to receive. should i use socket.poll(...). Any help will be appreciated, thnx.
while(true)
{
if(socket.Avaialable > 0)
{
socket.Receive(bytes);
break;
}
else
{
Thread.Sleep(n);
}
}
It's likely it is received, however, it is probably being merged into another send call, so that once receive call receives data from more than one send call. The Forum FAQ talks more about this. TCP is a stream protocol, not a packet protocol.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement