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


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

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

Started byMalte Forkel <malte.forkel@berlin.de>
First post2013-11-26 12:26 +0100
Last post2013-11-27 23:30 +0100
Articles 3 — 2 participants

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 Malte Forkel <malte.forkel@berlin.de> - 2013-11-26 12:26 +0100
    Re: How to determine whether client and server are on the same host Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2013-11-27 12:37 +1300
      Re: How to determine whether client and server are on the same host Malte Forkel <malte.forkel@berlin.de> - 2013-11-27 23:30 +0100

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

FromMalte Forkel <malte.forkel@berlin.de>
Date2013-11-26 12:26 +0100
SubjectRe: How to determine whether client and server are on the same host
Message-ID<mailman.3227.1385465406.18130.python-list@python.org>
Am 26.11.2013 00:41, schrieb Ben Finney:
> 
> On Unix, this is up to the person invoking the program: the “sockets
> facility allows for a host-local connection to appear as though it's
> going over a network.
> 
>     <URL:https://en.wikipedia.org/wiki/Localhost>
>     <URL:https://en.wikipedia.org/wiki/Unix_domain_socket>
> 
> In other words: Your program shouldn't go snooping around to
> second-guess the connection type; if the user asked for a TCP/IP
> connection, that's what they should get. If they want to take advantage
> of a local connection, they can use a Unix domain socket.
> 

Unfortunately, I can't rely on the user to use a specific way to specify
the (local) host. Therefor, the application has to detect if it is run
on the same host as the server.

May be my description was incomplete and somewhat misleading. Let me try
to provide more information.

The server is running on a Linux host. The application might be run on
any Windows or Linux host in the (local) network. When starting the
application, the user can specify the server by host and and a port. If
no host is specified, it defaults to localhost. If no port is specified,
a couple of well known ports are tried. The application establishes the
connection to the server using telnetlib.

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.

Malte

[toc] | [next] | [standalone]


#60553

FromGregory Ewing <greg.ewing@canterbury.ac.nz>
Date2013-11-27 12:37 +1300
Message-ID<bfkpm5Fjl4vU1@mid.individual.net>
In reply to#60500
Malte Forkel wrote:
> 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.

What would happen if you tried the file-based method when
it wasn't a local connection? Is there a danger of it
"succeeding" on the wrong machine and damaging something?

-- 
Greg

[toc] | [prev] | [next] | [standalone]


#60642

FromMalte Forkel <malte.forkel@berlin.de>
Date2013-11-27 23:30 +0100
Message-ID<mailman.3323.1385591469.18130.python-list@python.org>
In reply to#60553
Am 27.11.2013 00:37, schrieb Gregory Ewing:
>
> What would happen if you tried the file-based method when
> it wasn't a local connection? Is there a danger of it
> "succeeding" on the wrong machine and damaging something?
> 
I have been thinking about that.

There is a slight risk that the client might be talking to a server on a
remote host while there is a similar server running on the local
machine. That (local) server then might use a file by the same name as
the file on the remote server the client wants to operate on. In that
(unlikely) case I would mix up things big time...


[toc] | [prev] | [standalone]


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


csiph-web