Hello,
in af_inet.c, there is a comment in function inet_release():
It is OK to wait for completion if linger is set.Quote:> * If linger is set, we don't return until the close
> * is complete. Otherwise we return immediately. The
But it is not OK to return immediately otherwise.
Never linger when exiting ? Is this really accepted behaviour ?Quote:> * actually closing is done the same either way.
> *
> * If the close is due to the process exiting, we never
> * linger..
It looks like Linux 2.0 is behaving different from IRIX5 here.Quote:> */
> timeout = 0;
> if (sk->linger) {
> timeout = ~0UL;
> if (!sk->lingertime)
> timeout = jiffies + HZ*sk->lingertime;
> }
> if (current->flags & PF_EXITING)
> timeout = 0;
Who is right ? I ran into much trouble this summer because of this.
IRIX5 and WinNT/Cygwin seem to always "flush" when linger is off.
I switched on lingering because Linux needed it. But this got me
into REAL trouble with WinNT/Cygwin (IRIX5 is still fine).
In the socket FAQ, Andrew Gierth says:
If SO_LINGER has not been called on a socket, then close() is not
supposed to discard data. This is true on SVR4.2 (and, apparently,
on all non-SVR4 systems) but apparently not on SVR4; the use of
either shutdown() or SO_LINGER seems to be required to guarantee
delivery of all data.
Stevens agrees on this. But Stevens (UNP Vol1, 2nd Ed) also says on
page 188 that BSD measures linger time in 1/100 seconds while
Posix.1g measures time in seconds. This is a factor of 100 !
0.3 seconds or 5 minutes !
________________________________________________________________________
Juergen Kahrs Tel. 0421 249 666
Millstaetter Strasse 15 Tel. 0421 457 2819
D 28359 Bremen Fax 0421 457 3578
____________ http://home.t-online.de/home/Juergen.Kahrs/ _______________