I’m trying to make a chat server thing. Basically, I want more than one client to be able to connect at the same time.
I want it so it’s always listening. Whenever anyone tries to connect, it instantly accepts them and adds them to a list of connections.
I could have a listen(1) then a timeout, and keep appending them to a list then closing the socket, and making a new one, then listening with a timeout, etc. Although, this seems very slow, and I’m not even sure it would work
Keep in mind, it does not HAVE to be socket. If there is any other kind of network interface, it would work just as well.
There will be a practical limit on the maximum number of sockets based on the memory your system.
See http://docs.python.org/2/library/socketserver.html. I think the last few examples (under Asynchronous Mixins) come very close to what you want to achieve.