Hey, C! What's my IP?

Michael Halcrow mike at halcrow.us
Tue Jan 16 21:42:50 MST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160

On Tue, Jan 16, 2007 at 09:22:36PM -0700, Topher Fischer wrote:
> Is there a "standard" (de facto or otherwise) way of finding a local
> machine's IP address in C?

I think what you may want is to find the IP address of an interface
via SIOCGIFADDR:

http://publib.boulder.ibm.com/iseries/v5r2/ic2924/index.htm?info/apis/ioctl.htm

Also, try strace'ing ifconfig. Or just look at the source.

Mike
.___________________________________________________________________.
Why is it that when everyone freaks out, I'm always the one who gets 
the phone call?

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iQEUAwUBRa2pPttAhTFtyodpAQOfRwf2Iy2yCJAgtMqtzb5DCtmQmrm7x04NkmbF
tObPMkYS7arMJfE9Q4zRpWC4DEvRzVKnvDoL6i5V/UKB85vj+yxCL6wFH1UzB11+
6EKBFOeg6eg1b3fyqyvilkGe8J4L4tZgbsPtmaNfmoLMPqj4ILwr6DzB6TxWCqG6
2ln8EY+ffzAuxW8Qak8ntCFsqjybDOUYgn51o0+noo1Bi30YwMAp9pQevkZUfHHo
Vt2/dXNggq5KmXFNNZmiNe/NoBK8j15jnWSD5urudLdf43D6sclQXqimog8td2KS
/f2cfb2bcMRBsgcg037J24VdRUkfDA08NqcwqmGWNSJVT7N8/7Bj
=pLNa
-----END PGP SIGNATURE-----



More information about the PLUG mailing list