简体   繁体   中英

C programming - tcp socket remote port retrieving

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

The getpeername function gets information about the remote side, including the port number; getsockname does the same for the local side of the connection.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM