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


Groups > comp.lang.python > #60501

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

References <l708pt$r5b$1@ger.gmane.org> <7wfvqkrqvb.fsf@benfinney.id.au> <l720h8$792$2@ger.gmane.org>
Date 2013-11-26 22:38 +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.3228.1385465920.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Tue, Nov 26, 2013 at 10:26 PM, Malte Forkel <malte.forkel@berlin.de> wrote:
> Most of the application's functionality uses the telnet connection to
> communicate with the server. One special operation is not available in
> the protocol, but can be implemented by a direct file-based operation if
> the application is run on the server itself. I would like to use that
> option if technically feasible.

There is another way you might be able to do this. The server could
simply create a cookie in the file system - say, a file in /tmp with a
randomly-generated name - and it can announce that to the client. If
the client sees the same file in what it sees as /tmp, then it can
assume that it's running on the server. Obviously there's a miniscule
probability of an accidental collision, and someone could deliberately
fool it, but for a simple check, that might work.

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-26 22:38 +1100

csiph-web