From: Hoehle, Joerg-C. <Joe...@t-...> - 2002-05-15 15:05:50
|
Hi, MS-windoes woes below... Does anybody know how to tell MS-Windows sockets to gracefully send all the TCP data in the pipe down the road without causing an abort on the other side? Sam Steingold wrote: > Gesendet: Dienstag, 16. April 2002 15:58 > missed this. please try the patch: > +++ stream.d Tue Apr 16 09:56:35 2002 > @@ -14119,6 +14115,9 @@ > #if defined(UNIX_BEOS) || defined(WIN32_NATIVE) > local void low_close_socket (object stream, object handle) { > begin_system_call(); > + #ifdef WIN32_NATIVE > + if (shutdown(TheSocket(handle),SHUT_RDWR)) { SOCK_error(); } > + #endif > if (!( closesocket(TheSocket(handle)) ==0)) { SOCK_error(); } > end_system_call(); > } I finally went to the Microloft Developer Network and found: Graceful Shutdown, Linger Options, and Socket Closure http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/ovrvw3_3she.asp From there, one can navigate to shutdown, closesocket, setsockopt, getsockopt and linger. It appears from my tiny experiments that: shutdown(SD_BOTH) is no help shutdown(SD_SEND) slightly helps: i.e. a local web browser doesn't get an error anymore, but a remote connection only gets part of the output :-( :-( I.e. part of the HTML trailer and document data is missing, but no error is signaled(!?). Depending on sys::*inspect-debug* level, the remote side may even see 0 bytes (lower level => less bytes). The higher the machine load (second clisp executing (LOOP)), the more complete the response. The result of a remote's Python's urllib.urlopen("http://mymachine.telekom.de:2129/0/:s").read() can vary between ''(empty) to the full HTML output. Curiously, Mosaic-2.7b5 output is always truncated towards the end. To me it seems that doing recv() until EOF before closing is not acceptable (what MS recommends from what I understand). If I say to close, close. Don't read infinite incoming data from port chargen=19 ! Regards, Jorg Hohle. |