not correct socket closing

Кирилл yakovenko87 at
Wed Feb 10 16:34:13 CET 2010

Hi all,
I have got a small script for upload file on http server, and I need
interrupt uploading if I get tired wait.
I create socket:

self.conn = httplib.HTTPConnection("")
#self.conn.debuglevel = 1
self.conn.request("POST", "/upload/", body, head)
if self.conn.sock:
    self.conn.sock.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER,
struct.pack("ii",  1, 0))

and close it in other thread:

if self.conn.sock:

Python notify me what socket have closed, but he continues to send
As can I close it and stop sending of the data?

Best Regards,

More information about the Python-list mailing list