I have a small patch for cryptlib 3.2 to avoid a problem with handling EOF on Unix. Here's the explanation I sent to Peter about the problem: readSocketFunction() (in misc/net_tcp.c in 3.1, and io/tcp.c in 3.2) has code that looks like this (paraphrased): /* We've got data waiting, read it */ bytesRead = recv( stream->netSocket, bufPtr, bytesToRead, 0 ); if( isSocketError( bytesRead ) ) ... if( bytesRead == 0 ) { if( isRestartableError() ) { assert( !"Restartable read, recv() indicated no error" ); continue; } ... Where isRestartableError() checks "errno == EINTR || errno == EAGAIN". The problem is, when recv() returns 0 on EOF, it didn't modify errno, and there is in fact no error; but the loop continues to select and recv nevertheless, and the function never returns. The patch just removes the spurious check, which works fine on Unix. --- io/tcp.c~ 2005-04-26 10:54:51.153077738 +0530 +++ io/tcp.c 2005-04-26 10:18:18.939992468 +0530 @@ -1669,12 +1668,12 @@ static int readSocketFunction( STREAM *s uses a valid bytes-received value to indicate an out-of-band condition that should be reported via an error code ("There's nowt wrong wi' owt what mithen clutterbucks don't barley - grummit") */ + grummit") if( isRestartableError() ) { assert( !"Restartable read, recv() indicated no error" ); continue; - } + } */ /* Once this Winsock bug hits, we've fallen and can't get up any more. WSAGetLastError() reports no error, select() reports