我已经将python 2.7.1嵌入到基于C ++的应用程序(橘子酱)
中运行以下示例: https://docs.python.org/2/library/socket.html
import socket
socket.getaddrinfo("www.python.org", 80, 0, 0, socket.SOL_TCP)
[(2, 3, 3, '', ('23.235.47.175', 0))]
DEBUG:
SOCKET: s3eInetAton: 'www.python.org'
SOCKET: s3eInetLookup: 'www.python.org'
SOCKET: s3eInetLookup (synchronous): done DNS: '23.235.47.175:0'
IWCRT: gethostbyname www.python.org -> 4a700360
但是它应该是这样的,端口不等于零
[(2,1,6,'',('xx.xx.xx.xx', 80 )]
与getaddrinfo相同:
import sys, socket
result = socket.getaddrinfo("python.org", None, 0, socket.SOCK_STREAM)
for item in result:
print (item[4])
('140.211.10.69', 0)
('xx.xx.xx.xx', 80 )
仍然没有端口
关于可能导致这种情况的任何想法?