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


Groups > comp.lang.python > #60545

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

Path csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.025
X-Spam-Evidence '*H*': 0.95; '*S*': 0.00; 'detect': 0.07; 'socket': 0.07; 'subject:same': 0.07; 'yeah,': 0.09; 'subject:How': 0.10; 'random': 0.14; "'localhost',": 0.16; 'filesystem': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'hint': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'file,': 0.19; 'otherwise,': 0.22; 'comparing': 0.24; 'recognize': 0.24; 'initial': 0.24; 'file.': 0.24; 'possibly': 0.26; 'header:In- Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; "skip:' 10": 0.31; 'run': 0.32; '(i.e.': 0.33; 'guess': 0.33; 'subject:the': 0.34; 'could': 0.34; 'connection': 0.35; 'created': 0.35; 'received:google.com': 0.35; 'thanks': 0.36; 'server': 0.38; 'nov': 0.38; 'to:addr:python-list': 0.38; 'files': 0.38; 'to:addr:python.org': 0.39; 'either': 0.39; 'tell': 0.60; 'course': 0.61; 'name': 0.63; 'taking': 0.65; 'connection.': 0.74; 'hoping': 0.75; '127.0.0.1': 0.84; '4:26': 0.84; 'generation.': 0.91; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=NnTYiuyf193iIRhXEvbtAYcLMka+s50tOyy/KfZ3/ok=; b=uTo7RmE9R7uEh/p8zq1Ud786YU3zF0OLJCYHAeFzPbuzSMnlcTgvrwuZRltvYKrZIr dDALP0SdtQCQHn+h0hukicxTPl5WZ1zCIBUDfwcxKOwfrIGHH48EyfasAMPkgvA8BV5B RweMaN6YYd/ehiockEK1cQwdohL/B3D8RcDC8Tcwfn3dEtR8WLds4Wzy0lC3G8bh+IbW km3+n2NCOlLsJzPYFZhwxQKBy8tdAkrlK0PQQIxhNm/YFlhsrbkyVztYnt8+oaYBN5ke R2hTPRCjjZblhVxyBlVBp0Me5l9BXv6v47qdLT6Fk/5l/6e+ftZpKeAQ8nts+9M3onyc 5AEA==
MIME-Version 1.0
X-Received by 10.67.23.71 with SMTP id hy7mr37525516pad.99.1385506573776; Tue, 26 Nov 2013 14:56:13 -0800 (PST)
In-Reply-To <l72ljc$f1j$1@ger.gmane.org>
References <l708pt$r5b$1@ger.gmane.org> <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> <l72ljc$f1j$1@ger.gmane.org>
Date Wed, 27 Nov 2013 09:56:13 +1100
Subject Re: How to determine whether client and server are on the same host
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3259.1385506584.18130.python-list@python.org> (permalink)
Lines 20
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1385506584 news.xs4all.nl 15869 [2001:888:2000:d::a6]:60429
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:60545

Show key headers only | View raw


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


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