从Github上下了一个TensorFlow的工程文件,里面用到了socket的本地连接,使用AF_UNIX

使用的Win10的系统平台

发现找不到AF_UNIX的参数

在socket.py中查看注释,有这一句话:

"""
socketpair([family[, type[, proto]]]) -> (socket object, socket object)
Create a pair of socket objects from the sockets returned by the platform
socketpair() function.
The arguments are the same as for socket() except the default family is
AF_UNIX if defined on the platform; otherwise, the default is AF_INET.
"""

注意到AF_UNIX的存在取决于platform也就是平台

后继续深入到_socket.py文件查看参数定义,发现:

AF_APPLETALK = 16
AF_DECnet = 12
AF_INET = 2
AF_INET6 = 23
AF_IPX = 6
AF_IRDA = 26
AF_SNA = 11
AF_UNSPEC = 0

果然,AF_UNIX没有被定义

因此在Win10上使用,应该使用AF_INET

(个人觉得UNIX和Linux系统上应该能够支持AF_UNIX)

相关文章:

  • 2021-09-11
  • 2021-08-13
  • 2021-07-22
  • 2021-06-30
  • 2021-06-01
  • 2021-07-10
  • 2021-04-26
猜你喜欢
  • 2022-12-23
  • 2021-07-04
  • 2021-08-29
  • 2022-01-06
  • 2021-06-18
  • 2021-06-19
  • 2022-12-23
相关资源
相似解决方案