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


Groups > comp.lang.python > #60545 > unrolled thread

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

Started byChris Angelico <rosuav@gmail.com>
First post2013-11-27 09:56 +1100
Last post2013-11-27 09:56 +1100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: How to determine whether client and server are on the same host Chris Angelico <rosuav@gmail.com> - 2013-11-27 09:56 +1100

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

FromChris Angelico <rosuav@gmail.com>
Date2013-11-27 09:56 +1100
SubjectRe: How to determine whether client and server are on the same host
Message-ID<mailman.3259.1385506584.18130.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web