from requests.exceptions import ConnectionError
from socketIO_client import SocketIO
try:
socket = SocketIO('127.0.0.1', 5000, wait_for_connection=False)
socket.emit('my message', 'Hello world!')
socket.wait()
except ConnectionError:
print('The server is down. Try again later.')
运行SocketIO服务器之后,这段代码在ubuntu上运行良好,但在OS X 10.12.2上不起作用,它总是卡在" socket = SocketIO('127.0.0.1', 5000, wait_for_connection=False)
"中。
有人能告诉我这个有问题吗?
答案 0 :(得分:0)
我找到了答案。因为我为我的mac终端打开了http代理。