Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #60530

Re: How to determine whether client and server are on the same host

From Malte Forkel <malte.forkel@berlin.de>
Subject Re: How to determine whether client and server are on the same host
Date 2013-11-26 18:26 +0100
References (1 earlier) <7wfvqkrqvb.fsf@benfinney.id.au> <l720h8$792$2@ger.gmane.org> <CAPTjJmrt+dXUi9g3_Z6TvtHWO07=QGobtfCUbjnR5KhAq7Kr7w@mail.gmail.com> <l72395$8sm$1@ger.gmane.org> <CAPTjJmp7GgdKxqa+Twqjfs2hGpZC2G_pZ_je8R7JFcFBwChb=A@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.3252.1385486790.18130.python-list@python.org> (permalink)

Show all headers | View raw


Am 26.11.2013 13:26, schrieb Chris Angelico:
> If you deliberately create a file with a random name, the chances of
> one existing with the same name on the client are infinitesimal unless
> someone's deliberately trying to confuse things... in which case I
> wouldn't worry about it.
> 
I wouldn't, either. But the server is an existing application that I
can't extend. It does not support creating a file with a random name.

> No, because there's no such thing as a "local connection". For
> instance, I have two internet connections at my house, and I can
> telnet out on one of them and back in on the other - but both
> connections are NATted, so the machine itself doesn't have an IP that
> matches what I'm talking about here. I could have a socket connection
> from w.x.y.z port 12345 to a.b.c.d port 80, and there's no way
> telnetlib would recognize that as coming back to the same computer,
> because this computer's IP addresses are all RFC 1918 ones (127.0.0.1,
> 192.168.0.19, 192.168.2.2).
>
Thanks for the explanation. I guess I was hoping that I could use some
property of a connection created with telnetlib or its socket to find
out whether it was actually a host-local connection (i.e. a connection
to 'localhost', '127.xx.xx.xx' or '<local_host_name>').

So its either your initial suggestion of taking a hint from the user or
comparing files on the server and the client.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: How to determine whether client and server are on the same host Malte Forkel <malte.forkel@berlin.de> - 2013-11-26 18:26 +0100

csiph-web