[Twisted-Python] Socket number

Jean-Paul Calderone exarkun at divmod.com
Sun Jun 10 08:10:36 EDT 2007

On Sun, 10 Jun 2007 11:26:19 +0100, Simon Pickles <sipickles at hotmail.com> wrote:
>In my C++ game server, I used the socket number as the temporary ID of
>the connected player. Is there anyway to retrieve the socket number of a
>new player?
>Atm, I am just using self.transport.getPeer().host, but this is only the
>IP address, not socket.

Sockets may not have a file descriptor associated with them on all platforms.
It's trivial maintain a counter yourself and assign a small unique integer
to each client who connects.  Why not do that, instead?


More information about the Twisted-Python mailing list