Domanda

Ho demone che ha pool di connessioni a handlerSocket. Ho 2 tipi di clienti e le loro diverso protocollo. Voglio installare 2 ascoltatori che gestisce ogni piscina protocollo e condivide connessione tra di loro. In contorto questo è relativamente facile da realizzare, ma non riusciva a trovare il modo di fare questo in gevent. Grazie!

È stato utile?

Soluzione

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

Altri suggerimenti

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top