views:

615

answers:

3

Hello,

Say I have accepted() a connection to my server (that runs on a Solaris) and the client has closed the connection. What is the state of the socket (in netstat categories) of the socket on the server side before I close() it on the server side? Is it BOUND?

A: 

I guess, TIME_WAIT.

You may check it with "netstat" on Linux, don't know how do it on Solaris.

Seika
No, TIME_WAIT is _after_ socket is closed() on the local end. I asked about state before closing() the descriptor.
tadeusz
"netstat" will also work on Solaris
Beano
+6  A: 

It will be CLOSE_WAIT, see the tcp state diagram, e.g. on http://en.wikipedia.org/wiki/File:Tcp_state_diagram_new.svg

Anders Westrup
A: 

In this situation the socket on the client will be in TIME_WAIT and the socket on the server will go through CLOSE_WAIT and will move to CLOSED pretty quickly so you might not catch it in netstat before it vanishes from the list altogether.

Len Holgate