No error while sending via TCP Socket

Grant Edwards grante at
Fri Jun 30 16:48:38 CEST 2006

On 2006-06-30, Martin Bürkle <buerklma at> wrote:

> I have writen a programm using TCP sockets. After i get the
> connection to another socket I cut the Ethernet cable. Then I
> send a message. The program doesnt raise any exception. Can
> somebody tell me why

Because send() has successfully passed the packet to the
network stack.  If you want to know whether the application on
the other end received it, you need an application-layer
protocol that acknowleges the data.

> and give me a hint how to get an exception

You can't -- unless you've enabled the keepalive option on the
TCP connection and you've waited the requisite time after the
cable is cut before sending your data (IIRC it takes a couple
hours for an idle TCP connection to time out because of a link
being down).

TCP/IP is designed to be fault-tolerant.  Temporary breaks in
cables aren't supposed to cause failures.

Grant Edwards                   grante             Yow!  I feel like I'm
                                  at               in a Toilet Bowl with a
                                 thumbtack in my forehead!!

More information about the Python-list mailing list