Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!goblin2!goblin.stu.neva.ru!newsfeed1.swip.net!uio.no!nntp.uib.no!svn.schaathun.net!not-for-mail From: Hans Georg Schaathun Newsgroups: comp.lang.python Subject: sockets: bind to external interface Date: Mon, 25 Apr 2011 20:37:24 +0100 Organization: University of Bergen Lines: 16 Message-ID: NNTP-Posting-Host: vannskorpion.bccs.uib.no X-Trace: toralf.uib.no 1303759737 75227 129.177.20.20 (25 Apr 2011 19:28:57 GMT) X-Complaints-To: abuse@uib.no NNTP-Posting-Date: 25 Apr 2011 19:28:57 GMT User-Agent: slrn/pre1.0.0-18 (Linux) Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:3990 Is there a simple way to find the external interface and bind a socket to it, when the hostname returned by socket.gethostname() maps to localhost? What seems to be the standard ubuntu configuration lists the local hostname with 127.0.0.1 in /etc/hosts. (I checked this on two ubuntu boxen, on only one of which I am root.) Thus, the standard solution of binding to whatever socket.gethostname() returns does not work. Has anyone found a simple solution that can be administered without root privileges? I mean simpler than passing the ip address manually :-) TIA -- :-- Hans Georg