Problem with Linux sockets not closing

Jim Torelli (jtorelli@coolworld.com)
Thu, 8 May 1997 13:16:03 -0700 (PDT)


I have a tcp/ip client/server app that I wrote, and am having a
problem under Linux that I don't have under any other OS. When the server
(running on Linux 2.0.30) attempts to a socket, it goes to TIME_WAIT
(which is corect), and then moves to CLOSE (NOT CLOSE_WAIT). It seems to
have 1 byte left in the recieve queue. In the close state, it sets the
timer to somewhere between 2.5 and 3 seconds (I would assume to try to
send the last byte), counts down to 0, and then jumps right back to
between 2.5 and 3 seconds, in a seemenly endless loop.

The CloseSocket function sets SO_LINGER to abort the connection,
calls shutdown(), then close(). I really don't think I'm doing anything
wrong here.

Here is the output from netstat

Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
Timer
tcp 57 0 207.149.9.121:14916 152.2.254.81:21
CLOSE_WAIT off (0.00/0)
tcp 1 0 207.149.9.121:93 207.149.9.8:1187 CLOSE
on (1.84/0)
tcp 1 0 207.149.9.121:93 207.149.9.8:1188 CLOSE

Port 93 is the port the app runs on. Any ideas would be
appreciated.

Thanks
Jim