not correct socket closing

Кирилл yakovenko87 at gmail.com
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("192.168.0.195")
#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:
    self.conn.close()

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

Best Regards,
Kirill.



More information about the Python-list mailing list