T
Thomas Dybdahl Ahle
Hi, I'm writing an application that connects to the internet.
Something like this:
for res in socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM):
af, socktype, proto, canonname, sa = res
try:
self.sock = socket.socket(af, socktype, proto)
Now if the user press the cancel button, I'd like the connection to
imidiatly stop. I run
self.sock.shutdown(socket.SHUT_RDWR)
self.sock.close()
Dunno if they are both nessesary. I normaly use only the first, but it
makes no difference to use both.
If python is at the actual connection in socket.socket( this work fine,
but if python is at calling socket.getaddrinfo(, it doesn't stop.
I also can't kill the thread, as it is afaik not a possibility in python.
Is there any other way to do this?
Something like this:
for res in socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM):
af, socktype, proto, canonname, sa = res
try:
self.sock = socket.socket(af, socktype, proto)
Now if the user press the cancel button, I'd like the connection to
imidiatly stop. I run
self.sock.shutdown(socket.SHUT_RDWR)
self.sock.close()
Dunno if they are both nessesary. I normaly use only the first, but it
makes no difference to use both.
If python is at the actual connection in socket.socket( this work fine,
but if python is at calling socket.getaddrinfo(, it doesn't stop.
I also can't kill the thread, as it is afaik not a possibility in python.
Is there any other way to do this?