Tag: python asyncio

asyncio客户端服务器在docker中不起作用

我有客户端和服务器(通过HTTP发送json消息)在我的标准Ubuntu的16.04工作正常 但后来我试图运行它的客户端和服务器内泊坞窗或客户端外的docker和服务器里面我有错误。 我的docker命令: sudodocker运行-p 127.0.0.1:8888:8888 -i -t seo_server 这是我的服务器和客户端代码和错误: 服务器 import asyncio import json import aiohttp import re async def get_cy(domain): return {'result': 'ok','value':10} async def handle(reader, writer): # data = await reader.read(1000) data = bytearray() while not reader.at_eof(): chunk = await reader.read(2 ** 12) data += chunk # print(json.loads(data)) # https://aiomas.readthedocs.io/en/latest/ message = data.decode() […]