Re: CLOSE_WAIT vs. EOF

iksrazal_at_terra.com.br
Date: 06/22/05


Date: 21 Jun 2005 15:36:45 -0700

Thanks for the reply - I appreciate the patience with my terminology.
You helped a lot by saying the server side is closed when the client
side socket is in CLOSE_WAIT.

I think I have learned that the EOF I talk about needs to be sent to
the _client_ application on the local machine by the API of the running
application. If I understand correctly, after CLOSE_WAIT there could be
data still in the buffer on the client side, but in this case I have
read all data after the QUIT I send to the server.

Unfortunately I cannot just close the connection via the java
SocketChannel.close() command as that is not enough on linux and other
platforms such as Sun. See this bug report if interested (I didn't file
it).

http://bugs.sun.com/bugdatabase/view_bug.do;:YfiG?bug_id=6215050

Some purists say that by calling close(), and not closing the Socket,
it is not a bug, but anyways...

>>From a tcp/linux perspective, my questions are:

1) What is the state - on the client side - after CLOSE_WAIT ? Can
reading and discarding any buffered data on the client side and sending
EOF to the client application change the state from CLOSE_WAIT to
something else? Is the socket closed when I no longer see CLOSE_WAIT?

2) If I understand correctly, the are 5 tcp states: SYN, ACK, data,
FIN, and RST . Which of those can I think of when netstat shows
CLOSE_WAIT, and which of those follows the CLOSE_WAIT to the next
state?

iksrazal



Relevant Pages

  • Re: Socket switch delay
    ... both at the client and at the server (and why ... would you set the send buffer size to zero on a non-overlapped ... One glaring error is your client does ... So when you use a single socket, ...
    (microsoft.public.win32.programmer.networks)
  • Re: Locking on async calls
    ... you must synchronize the entire SendMessage routine as an atomic ... operation to prevent mixed messages from being transmitted to the server. ... You are correct that read and write on the socket do not interfere with each ... If you want to handle multiple client connections from one server object ...
    (microsoft.public.dotnet.general)
  • Re: Design issue with WinSock/GetQueuedCompletionStatus
    ... delegate that to a shutdown routine called after all worker threads ... The application I've created is a server accepting connections on a few ... different TCP/IP ports and then lets the client run different commands. ... a TCP/IP socket can be closed for 2 different reasons: ...
    (microsoft.public.win32.programmer.networks)
  • Re: socket communication: socket doesnt connect
    ... Microsoft MVP, MCSD ... As far as your server code goes, ... accept the listening socket. ... Client client = new Client; ...
    (microsoft.public.vc.language)
  • Re: TCP server stop receiving new connections
    ... reset the event mask of your listening socket each time you ... I have a strange problem in my class library used by all our client ... server applications. ... incomming connections, but keeps current connections. ...
    (microsoft.public.win32.programmer.networks)