SimpleXMLRPCServer and client address

Stephen Hansen apt.shansen at gmail.com
Wed Feb 10 22:56:49 EST 2010


On Wed, Feb 10, 2010 at 5:36 PM, Jean-Michel Pichavant <
jeanmichel at sequans.com> wrote:

> I don't know exactly what you are trying to do, but if your server requires
> informations from the client, it would be better to ask explicitly the
> client for those informations.
> For instance, if a method requires te client IP address, then the IP
> address is definitely a parameter of the method.
>

I can't answer the OP, as I don't know the answer to his specific question--
but er, asking a client to provide one's IP address is not really a very
workable solution. There's no way to really determine your own IP address in
a reliable way.

All the usual methods (e.g., socket.gethostbyname(socket.gethostname())) can
fail and/or be wrong in some not terribly uncommon situations. The only
reliable way to get such a piece of information is to connect to a server,
and ask that server what address you were connecting to them as. Even then,
that IP may not be the same as an IP you use to connect to say, a different
server (on a different network)

--S
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100210/a3b1d704/attachment-0001.html>


More information about the Python-list mailing list