gettin the private address

juliaprocess's Avatar, Join Date: Aug 2006
Go4Expert Member
hello,

how do i find my private address assigned by the NAT box? Like when you type ipconfig

I can get the public address and I tried to use getsockName to get the private, but it just returns the 127.0.0...... instead of what the nat assigned, i looked for it all over the place , any suggestions?
DaWei's Avatar, Join Date: Dec 2006
Team Leader
I'm working off a memory that's reaching far into the past. Have you tried "gethostbyname" or "getaddr info"?
juliaprocess's Avatar, Join Date: Aug 2006
Go4Expert Member
no, but i'll give it a try, for the benefit of other people i also found this

http://tangentsoft.net/wskfaq/examples/ipaddr.html
DaWei's Avatar, Join Date: Dec 2006
Team Leader
Excellent, thanks for providing the link. Incidentally, the structures used by the functions I mentioned are equipped to store multiple names and addresses, if I recall correctly. Have you read Beej's stuff on socket programming? It primarily addresses the issue from the point of Unix derivatives, but almost everything there is applicable to Windows, as well, and he even has some commentary regarding that.