Re: ifconfig in python

2009-01-20 Thread Mark Wooding
"bruce" writes: [a top-posted monstrosity] > so the question really starts to look like: > > -what's the default listening address for my app (insert nic)? > -what's the default sending address for my app (insert nic)? > -what's the default listening address for my server? > -what's the defa

RE: ifconfig in python

2009-01-20 Thread bruce
nk@python.org]on Behalf Of Nehemiah Dacres Sent: Tuesday, January 20, 2009 10:04 AM To: Mark Wooding Cc: python-list@python.org Subject: Re: ifconfig in python That doesn't mean that you can get away with a single address for the entire host, though: you need addresses which correspond

Re: ifconfig in python

2009-01-20 Thread Nehemiah Dacres
> > That doesn't mean that you can get away with a single address for the > entire host, though: you need addresses which correspond to the networks > you're attached to. > > -- [mdw] especially sense we are also getting into virtual NICs where you can have a webserver listening to one and broadca

Re: ifconfig in python

2009-01-20 Thread Mark Wooding
"rasikasriniva...@gmail.com" writes: > one way to get your head around this is - IP Addresses are associated > with the interface and not the computer. distinction may be subtle but > critical. Actually this is wrong for most Unix systems, which use the `weak end-system model' described in RFC11

Re: ifconfig in python

2009-01-20 Thread Nehemiah Dacres
I'll let this thought fester but I thought I'd put together a PEP to make this a function. Possibly in some util library but preferibly in the sys library sense this is where to get information about the system you are running on. On Tue, Jan 20, 2009 at 6:33 AM, Mark Wooding wrote: > Дамјан Гео

RE: ifconfig in python

2009-01-20 Thread bruce
ts/comments are of course welcome! -Original Message- From: python-list-bounces+bedouglas=earthlink@python.org [mailto:python-list-bounces+bedouglas=earthlink@python.org]on Behalf Of Ned Deily Sent: Monday, January 19, 2009 6:49 PM To: python-list@python.org Subject: Re: ifconf

Re: ifconfig in python

2009-01-20 Thread rasikasriniva...@gmail.com
On Jan 20, 7:33 am, Mark Wooding wrote: > Дамјан Георгиевски writes: > > Something *like*  this could work: > > >    myip = urllib2.urlopen('http://whatismyip.org/').read() > > This is going to cause all manner of problems. > > Firstly, many users are stuck behind NAT routers.  In this case, the

Re: ifconfig in python

2009-01-20 Thread Mark Wooding
Дамјан Георгиевски writes: > Something *like* this could work: > > myip = urllib2.urlopen('http://whatismyip.org/').read() This is going to cause all manner of problems. Firstly, many users are stuck behind NAT routers. In this case, the external service will report the address of the r

Re: ifconfig in python

2009-01-19 Thread alex goretoy
ifconfig -a|grep "inet addr"|awk '{print $2}' wget http://myip.dk&&; cat index.html|grep "http://www.alexgoretoy.com somebodywhoca...@gmail.com On Tue, Jan 20, 2009 at 3:42 AM, Дамјан Георгиевски wrote: > Something *like* this could work: > >myip = > urllib2.urlopen('http://whatismyip

Re: ifconfig in python

2009-01-19 Thread Дамјан Георгиевски
Something *like* this could work: myip = urllib2.urlopen('http://whatismyip.org/').read() of course then you are depending on an external service, not a very reliable one even. But then again, you might create an internal service like that yourself. This cgi-bin shell code like this fo

Re: ifconfig in python

2009-01-19 Thread Mark Wooding
"James Mills" writes: > On Tue, Jan 20, 2009 at 10:28 AM, Nehemiah Dacres > wrote: >> Is ther an easy way to get the resolved ip address of the machine a >> script is running on? socket.gethostbyname(socket.gethostname) has >> only returned the ip address of my loop back interface ... not very

Re: ifconfig in python

2009-01-19 Thread James Mills
On Tue, Jan 20, 2009 at 12:48 PM, Ned Deily wrote: > Also, since the subject is on my brain at the moment, how to find "the > address" is not the right question to ask. These days most systems have > multiple network interfaces (Ethernet, WiFi, dialup, et al) running > multiple protocols, like IP

Re: ifconfig in python

2009-01-19 Thread Ned Deily
In article , "James Mills" wrote: > On Tue, Jan 20, 2009 at 10:28 AM, Nehemiah Dacres > wrote: > > Is ther an easy way to get the resolved ip address of the machine a script > > is running on? socket.gethostbyname(socket.gethostname) has only returned > > the ip address of my loop back interf

Re: ifconfig in python

2009-01-19 Thread James Mills
On Tue, Jan 20, 2009 at 10:28 AM, Nehemiah Dacres wrote: > Is ther an easy way to get the resolved ip address of the machine a script > is running on? socket.gethostbyname(socket.gethostname) has only returned > the ip address of my loop back interface ... not very usefull. That's because your /e

ifconfig in python

2009-01-19 Thread Nehemiah Dacres
Is ther an easy way to get the resolved ip address of the machine a script is running on? socket.gethostbyname(socket.gethostname) has only returned the ip address of my loop back interface ... not very usefull. -- "lalalalala! it's not broken because I can use it" http://linux.slashdot.org/com