Winsock 2, windows xp sp3.
I have a socket, it was previously passed to the bind() function, now I want to get this information from the socket.
More specifically, I want the port number that the socket was bound to.
All I have is the SOCKET instance.
How would I go about doing this?
The socket is UDP by the way.
My purpose is that I want to create a new raw UDP socket and build the ip header and udp header and tunnel information through the raw socket instead, but I don’t know what to put into the source port because I don’t know what it was bound to.
getsockname()should help you.