+ 1
How can I make a socket connect as a background process in a function .
I tried def connect (address): Socket_name.connect (address) But it disconnects once the function is done completely .
2 Respostas
+ 1
Hi.
I am not very clear on sockets in python but I am pretty sure it is due to the scope that your codes exits when returning from the "def connect(address):" function.
Try handing over the socket you want to connect too (but that would look weird) or define the socket globally
0
Actually you have a point. I will try multithreading along with it.