Matt Herzog wrote: > Hi All. > > I'm trying to write a script that will send me an email message when my IP > address changes on a specific NIC. On Linux, the script works. On FreeBSD, > it fails with: > > [snip] > > def get_ip_address(ifname): > s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) > return socket.inet_ntoa(fcntl.ioctl( > s.fileno(), > 0x8915, # SIOCGIFADDR > struct.pack('256s', ifname[:15]) )[20:24]) >
[OT: sorry Matt, hit email instead followup twice... stupid me] My bets are that the SIOCGIFADDR opcode has a different numerical value for BSD. Even if some names are portable, the numerical values aren't! I don't have BSD, but using find /usr/include -type f -name '*.h' | xargs grep SIOCGIFADDR /dev/null should give some hints... -- juergen 'pearly' perlinger "It's hard to make new errors!" -- http://mail.python.org/mailman/listinfo/python-list