[ee122] gathering info with random unused ports (sin_port == 0)
huntingtonsurfca at gmail.com
Sun Nov 25 22:47:49 PST 2007
So Beej told me that if I want to bind a socket to a random port number, I
can just set the sAddr_in.port to 0. Then the kernel will decide which port
>From there, though, how do I figure out what port the kernel chose? Did it
overwrite the value? Is there a function analogous to getpeername() where
the struct gets filled in with info?
I need to advertise the second (incoming on the initiator side) socket to
the reciever if he is intending to send things back, but I can't find where
to get my random port number for the socket I'm using.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the ee122