Reputation: 21
I have a tcp connected socket handle, created through an accept. Only the handle, not other structs. How can I retrieve its REMOTE port from the handle? I mean, the tcp source port of the connection Remote Client ---> Me
Upvotes: 2
Views: 4060
Reputation: 308101
The getpeername
function gets information about the remote side, including the port number; getsockname
does the same for the local side of the connection.
Upvotes: 8