Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: binary X-RT-Original-Encoding: iso-8859-1 Content-Length: 333 A WIN32 SOCKET is a HANDLE type and is not equivalent in size to an 'int'. Windows SOCKET values frequently exceed MAX_INT and become truncated. convert all references to SOCKET and use closesocket() to release the them instead of the C Runtime Library close() which only applies to file descriptors. Proposed patch attached.