Hi I'm reading a tutorial on sockets, the Beej one I'm sure alot of you have read it. Anyways
it says that before I call bind() I can use INADDR_ANY as my ip and 0 as my port and then bind() will "fill in" the ip that the current process is running on and pick a port for me.
Ok the call to bind() works, so I'm assuming it somehow used my ip because if I try using an invalid IP bind() fails. When I try to print out my ip and port after the call to bind, all I get are zero's. When I specify a port and ip myself It prints them out correctly. Am I write in assuming that bind does not fill in the sockaddr_in structure for you but does find your ip and use a port for the call to bind()? I know there are other ways to get ip's but this is bugging me, especially cause bind() works so it must have my ip. Any help would be great.