开发者

Knowing the family with Socket Descriptor

开发者 https://www.devze.com 2023-03-14 13:59 出处:网络
I have the socket descriptor which is the return value of socket API. How can I use only this to know the fa开发者_如何学编程mily?You can call getsockname, but only after the socket is bound.(Windows-

I have the socket descriptor which is the return value of socket API. How can I use only this to know the fa开发者_如何学编程mily?


You can call getsockname, but only after the socket is bound.


(Windows-specific): you can get SO_PROTOCOL_INFO socket option.

If successful, it would give you WSAPROTOCOL_INFO structure with iAddressFamily member.

0

精彩评论

暂无评论...
验证码 换一张
取 消