简体   繁体   中英

Get remote address/IP - C Berkeley Sockets

If I have a socket file descriptor connected (either by connect or by bind), type SOCK_STREAM , is it possible to get the remote address / IP address?

I need to do this within a function where I don't have any other data than the socket file descriptor.

请参阅getpeername()系统调用。

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