how to detect connection closed by server?
Jacek Trzmiel
sc0rp at hot.pl
Wed Mar 24 00:42:15 EST 2004
Joe Wong wrote:
> Client:
> - 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
either:
- 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.
Best regards,
Jacek.
More information about the Python-list
mailing list