Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #60545
| References | (2 earlier) <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> <l72ljc$f1j$1@ger.gmane.org> |
|---|---|
| Date | 2013-11-27 09:56 +1100 |
| Subject | Re: How to determine whether client and server are on the same host |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3259.1385506584.18130.python-list@python.org> (permalink) |
On Wed, Nov 27, 2013 at 4:26 AM, Malte Forkel <malte.forkel@berlin.de> wrote:
> 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.
You can still have a unique file, then; all you sacrifice is the
random name generation. And you can of course recognize 127.x.y.z as
local - it's just not the _only_ way to detect a local connection.
Since this is, presumably, an optimization, you could possibly just
tell people that it'll run faster if they tell it 127.0.0.1 than if
they tell it {whatever other IPs the server has}. That may end up
sufficient. Otherwise, yeah, detect by filesystem with a
manually-created file.
ChrisA
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: How to determine whether client and server are on the same host Chris Angelico <rosuav@gmail.com> - 2013-11-27 09:56 +1100
csiph-web