Determine between socket and fd

后端 未结 4 682
挽巷
挽巷 2021-02-13 06:04

On unix everything is a file approach of function read(), write(), close() is not supported on Win32.

I

4条回答
  •  悲哀的现实
    2021-02-13 06:58

    I suspect... but I am not sure, that fds and sockets on Windows use separate namespaces. Therefore the number for a socket and a file could be the same, and it is impossible to know which one you are talking about when you call is_net_socket.

    Try printing out socket and fd numbers to see if they are ever the same as each other at the same time.

提交回复
热议问题