问题描述
尝试了互联网上的所有内容,但没有任何效果。 我有两个烧瓶应用程序都在SocketIO上运行: 在端口5000上运行的App 1。 在端口5001上运行的App 2在端口6002上创建线程
我们的目标是将数据从第一个应用程序发送到第二个应用程序。
当应用程序1向应用程序2发送数据时,会发生以下情况:
- 为App2创建新管道
@socketio.on('connect')
def start_chats_thread():
"""
Creates new background task that starts a thread to listen for incoming data
"""
global thread
with thread_lock:
if thread is None:
thread = socketio.start_background_task(new_messages_job)
def new_messages_job():
"""
Should Get Data from App 1 and call to send_message() that send data to users
"""
address = ('localhost',6002)
listener = Listener(address,authkey=b'abc')
while True:
conn = listener.accept()
msg = conn.recv()
send_message(msg[0],users_ids=msg[1])
listener.close()
- 应用2正在监听端口6002,并应使用以下功能接收数据:
for (k = 0; k < s.num; k++) {
if (i == s.ele[k].i && j == s.ele[k].j) {
printf("%d ",s.ele[k].x);
break;
}
}
// not found among the sparse elements
if (k == s.num) {
printf("0 ");
}
[WinError 10035]无法立即完成非阻塞套接字操作 在发生该错误之后,线程将关闭。
我们认为listener.accept()中存在问题。
我们将不胜感激。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)