how to detect connection closed by server?
sc0rp at hot.pl
Wed Mar 24 06:42:15 CET 2004
Joe Wong wrote:
> - create socket
> - connect to port XYZ at server
> - send some data to server
> - close the socket
> The problem I found is that, after the server perform the listen()
> call, the client program can sucessfully perform connect(), send() and
> close() on the socket
AFAIR with T/TCP it's entriely possible to open connection, send small
payload and close connection in one single IP packet.
> even the server process does not perform the
> accept() and recv() call. Is this a general behaviour of the socket or
> I am not writing my program properly?
Close only sending part of the socket and then block on read. It will
- report EOF if server accepted and then closed connection without
sending any data,
- return some data if server sent it,
- report some kind of error otherwise.
More information about the Python-list