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


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

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

Started byBen Finney <ben+python@benfinney.id.au>
First post2013-11-26 10:41 +1100
Last post2013-11-26 10:41 +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 Ben Finney <ben+python@benfinney.id.au> - 2013-11-26 10:41 +1100

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

FromBen Finney <ben+python@benfinney.id.au>
Date2013-11-26 10:41 +1100
SubjectRe: How to determine whether client and server are on the same host
Message-ID<mailman.3205.1385422916.18130.python-list@python.org>
Malte Forkel <malte.forkel@berlin.de> writes:

> I have a Python application that communicates with a server via
> telnet. Host and port of the server are supplied by the user when the
> application is started.
>
> How can I determine from within the application whether the server's
> host actually is the local host? (In that case I could implement an
> operation not available in the telnet-based protocol by directly
> accessing the local filesystem.)

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.

-- 
 \     “I wrote a song, but I can't read music so I don't know what it |
  `\    is. Every once in a while I'll be listening to the radio and I |
_o__)        say, ‘I think I might have written that.’” —Steven Wright |
Ben Finney

[toc] | [standalone]


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


csiph-web