我对sockets很困惑……我有两个脚本,一个是server.py,第二个是client.py:
服务器.py
import socket
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind(('0.0.0.0', 1235))
server.listen(1)
while True:
client, address = server.accept()
try:
client.recv(1024)
except socket.Timeouterror:
print 'timeout'
客户端.py
import socket
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect(('ip', 1235))
为什么 server.py 脚本不显示超时错误?