Question

I have daemon which has connection pool to handlerSocket. I have 2 types of clients and their protocol differs. I want to setup 2 listeners which handles each protocol and shares connection pool between them. In twisted this is relatively easy to accomplish, but couldn't find out how to do this in gevent. Thanks!

Was it helpful?

Solution

first instance of StreamServer could be started with: server.start() and second with server2.serve_forever()

OTHER TIPS

In addition to frx's answer, here's a class to manage multiple servers: https://gist.github.com/1008826

I think the problem will come from the StreamServer's stop() method. It kills the pool, so, finishing one of listeners will drop all connections, from both listeners. If this is does not frighten you, you can simply pass the same Pool object to both StreamServers, running each of them in the separate greenlet.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top