<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
I've been reading up on SO_LINGER.<BR>Search the web..<BR>
 <BR>
<BR>There are two or three options, depending on how you view it.<BR>
 <BR>
<BR>onoff=0<BR>time=ignored<BR>
 <BR>
 <BR>
onoff=1<BR>time=non-zero<BR>
 <BR>
<BR>onoff=1<BR>time=0<BR>You could view this as an example of the previous.<BR>
<BR> <BR>
The behavior is governed by additional bits.<BR>  - does the socket of buffered unset data?<BR>  - is the socket blocking?<BR>
<BR> <BR>
Some options result in the socket being "immediately"<BR>closed and unsent buffered data not being sent,<BR>
and I think possibly the other side getting an error.<BR>
 <BR>
<BR>Some options have close return immediately but<BR>send the buffered data in the "background".<BR>This I believe is the default.<BR>
 <BR>
<BR>Some options have close block waiting for send to finish.<BR>This has pluses/minuses.<BR>The minus is -- what timeout to use?<BR>A plus and minus is, I believe, there is an opportunity for<BR>close to timeout and fail, letting the caller know that<BR>there was a failure to deliver data.<BR>It is good to know about failure, though you'd want to<BR>know if the code was ready to somehow handle the failure.<BR>
 <BR>
<BR>onoff=0 seems "best".<BR>onoff=1, time=0 seems "bad".<BR>onoff=1, time="large" seems "ok", depending on how large.<BR>
 <BR>
<BR>I think onoff=0 is the default.<BR>I will verify that with some getsockopt runs.<BR>
 <BR>
<BR>If it is the default, I think we should just remove the setsockopt(so_linger) code.<BR>
 <BR>
<BR>One might also imagine that 1 second is not a short time, so even the Windows<BR>code isn't far off from the Posix code. The only big change would be<BR>setting 1,0 or removing setting of 1,0.<BR>
 <BR>
<BR>What I wish we had but don't know if we have, is some major Modula-3<BR>user of sockets on both Posix and Windows, so that the change can be<BR>tested.<BR>
 <BR>
<BR>I think there is a basic problem in networking code, of unreliability<BR>and inconsistent timing. You don't know how long to wait for something to occur,<BR>when to give up waiting and deciding it failed.<BR>
 <BR>
<BR> - Jay<BR><BR><BR><BR><BR><BR>                                         </body>
</html>