Revision: 18031
Updated Code
at September 21, 2009 22:49 by wearetherock
Updated Code
def getIpAddress(self, ifname):
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
return socket.inet_ntoa(fcntl.ioctl(
s.fileno(),
0x8915,
struct.pack('256s', ifname[:15])
)[20:24])
Revision: 18030
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at September 21, 2009 22:48 by wearetherock
Initial Code
def getIpAddress(self, ifname):
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
return socket.inet_ntoa(fcntl.ioctl(
s.fileno(),
0x8915,
struct.pack('256s', ifname[:15])
)[20:24])
Initial URL
Initial Description
Initial Title
Get IP Address (only linux)
Initial Tags
python, linux, ip
Initial Language
Python