【发布时间】:2017-07-12 07:35:28
【问题描述】:
在一个简单的聊天客户端的基础上工作,并得到以下错误:
socket.error: [Errno 10049] The requested address is not valid in its context
代码是:
from socket import *
HOST = ''
PORT = 8000
s = socket(AF_INET, SOCK_STREAM)
s.connect((HOST, PORT))
i = True
while i is True:
msg = raw_input("Write A MSG: ")
s.send(msg)
print "Awaiting reply"
reply = s.recv(1024)
print "Recived: ", repr(reply)
s.close()
感谢您的帮助。
【问题讨论】:
-
错误在哪一行?此外,可能重复 stackoverflow.com/questions/7162869/…
-
您可以在此处查找windows error codes,这似乎是您正在使用的平台。我怀疑您遇到的问题是您的 HOST 变量为空。
-
请提供完整的追溯