🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Getting a IP from a Socket

Started by
0 comments, last by Galileo430 23 years, 5 months ago
Ok here''s how I setup my sockaddr_in. I was just wondering how to get what IP it picks for INADDR_ANY.
  	
socConnection[0] = socket( AF_INET, SOCK_STREAM, 0);
adrServer[0].sin_family = AF_INET;
adrServer[0].sin_port = htons (5555);
adrServer[0].sin_addr.s_addr = htonl (INADDR_ANY);
  
Or am I on the wrong track?
------------------------------------------------------------I wrote the best video game ever, then I woke up...
Advertisement
getsockname should do the trick.

However it may not work until the socket has been connected and/or you''ve done at least one I/O.

-Mike

This topic is closed to new replies.

Advertisement