how do I stop SocketServer()?

A

Alexandru Mosoi

supposing that I have a server (an instance of SocketServer()) that
waits for a connection (ie is blocked in accept()) and in another
thread i want to stop the server, how do I do that?
 
D

Diez B. Roggisch

Alexandru said:
supposing that I have a server (an instance of SocketServer()) that
waits for a connection (ie is blocked in accept()) and in another
thread i want to stop the server, how do I do that?

By setting a timeout on the socket using socket.settimeout, and then
periodically check for an abortion condition in the server thread before
re-accepting connections.

Diez
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top