tcp/ip accept not returning, but client does

Posted by paquetp on Stack Overflow See other posts from Stack Overflow or by paquetp
Published on 2010-06-09T03:55:18Z Indexed on 2010/06/09 4:02 UTC
Read the original article Hit count: 213

Filed under:
|
|
|
|

server:
vxworks 6.3
calls the usual socket, bind, listen, then:

for (;;)
{
  client = accept(sfd,NULL,NULL);
  // pass client to worker thread
}

client:
.NET 2.0
TcpClient constructor to connect to server that takes the string hostname and int port, like:

TcpClient client = new TcpClient(server_ip, port);

This is working fine when the server is compiled and executed in windows (native c++).

intermittently, the constructor to TcpClient will return the instance, without throwing any exception, but the accept call in vxWorks does not return with the client fd. tcpstatShow indicates no accept occurred.

What could possibly make the TcpClient constructor (which calls 'Connect') return the instance, while the accept call on the server not return? It seems to be related to what the system is doing in the background - it seems more likely to get this symptom to occur when the server is busy persisting data to flash or an NFS share when the client attempts to connect, but can happen when it isn't also.

I've tried adjusting priority of the thread running accept
I've looked at the size of the queue in 'listen'. There's enough.
The total number of file descriptors available should be enough (haven't validated this yet though, first thing in the morning)

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET