Python Socket Multiple Clients

后端 未结 5 1583
难免孤独
难免孤独 2020-11-29 22:23

So I am working on an iPhone app that requires a socket to handle multiple clients for online gaming. I have tried Twisted, and with much effort, I have failed to get a bunc

5条回答
  •  春和景丽
    2020-11-29 23:04

    accept can continuously provide new client connections. However, note that it, and other socket calls are usually blocking. Therefore you have a few options at this point:

    • Open new threads to handle clients, while the main thread goes back to accepting new clients
    • As above but with processes, instead of threads
    • Use asynchronous socket frameworks like Twisted, or a plethora of others

提交回复
热议问题