T
Tomas Christiansen
Is there a way to make shure that all packets has been sent before issuing
a Shutdown and/or Close on a (TCP) Socket?
The problem is that "the other end" interprets a reset-flag (RST) on an IP-
packet as an indication of an error. Instead the finish-flag (FIN) must be
set, in order to close the connection non-errornously. That can be achieved
by using socket.shutdown(SHUT_RDWR) followed by socket.close().
BUT if all data has not been sent, sometimes shutdown(SHUT_RDWR) followed
by close(), sets RST, and the other end thinks that something went wrong
(the other end is some unknown TCP/IP printer) and goes to an error-state.
a Shutdown and/or Close on a (TCP) Socket?
The problem is that "the other end" interprets a reset-flag (RST) on an IP-
packet as an indication of an error. Instead the finish-flag (FIN) must be
set, in order to close the connection non-errornously. That can be achieved
by using socket.shutdown(SHUT_RDWR) followed by socket.close().
BUT if all data has not been sent, sometimes shutdown(SHUT_RDWR) followed
by close(), sets RST, and the other end thinks that something went wrong
(the other end is some unknown TCP/IP printer) and goes to an error-state.