python - listening on multiple twisted endpoints -
i have multiple server endpoints listening on different ports, using same protocol , factory
how know 1 has made connection first?
endpoint1 = tcp4serverendpoint(reactor, 8007) endpoint.listen(qotdfactory()) endpoint2 = tcp4serverendpoint(reactor, 8008) endpoint2.listen(qotdfactory()) and on....
there's no way tell difference, since objects you've constructed same. if wanted tell difference, consider like:
endpoint1 = tcp4serverendpoint(reactor, 8007) endpoint.listen(qotdfactory("tweedledee")) endpoint2 = tcp4serverendpoint(reactor, 8008) endpoint2.listen(qotdfactory("tweedledum")) then, in qotdfactory.buildprotocol, can print out whether mill tweedledee or tweedledum.
python twisted
No comments:
Post a Comment