[英]Knowing the family with Socket Descriptor
I have the socket descriptor which is the return value of socket API. 我有套接字描述符,它是套接字API的返回值。 How can I use only this to know the family?
我如何仅以此来认识家人?
您可以调用getsockname
,但只能在套接字绑定之后。
(Windows-specific): you can get SO_PROTOCOL_INFO socket option. (特定于Windows):您可以获取SO_PROTOCOL_INFO套接字选项。
If successful, it would give you WSAPROTOCOL_INFO structure with iAddressFamily
member. 如果成功,它将为您提供带有
iAddressFamily
成员的WSAPROTOCOL_INFO结构。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.