Send all packets (socket programming)

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top