[英]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?如果我连接了套接字文件描述符(通过连接或绑定),输入SOCK_STREAM
,是否可以获得远程地址/IP 地址?
I need to do this within a function where I don't have any other data than the socket file descriptor.我需要在一个除了套接字文件描述符之外没有任何其他数据的函数中执行此操作。
请参阅getpeername()
系统调用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.