Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sockets/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python套接字服务器-在Windows上未接收Adobe AIR客户端数据_Python_Sockets_Air_Platform - Fatal编程技术网

Python套接字服务器-在Windows上未接收Adobe AIR客户端数据

Python套接字服务器-在Windows上未接收Adobe AIR客户端数据,python,sockets,air,platform,Python,Sockets,Air,Platform,我使用以下代码在Python中设置了socketserver(我的第一个Python程序): class setupServer(threading.Thread): def __init__(self, host, port): threading.Thread.__init__(self) self.host = host self.port = port def now(self): d = datetime.datetime.now() retu

我使用以下代码在Python中设置了socketserver(我的第一个Python程序):

class setupServer(threading.Thread):
def __init__(self, host, port):
    threading.Thread.__init__(self)
    self.host = host
    self.port = port

def now(self):
    d = datetime.datetime.now()
    return d.strftime("%d/%m/%y %H:%M:%S")

def run(self):
    server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    server.bind((self.host, self.port))
    server.setblocking(0)
    server.listen(3)
    inputs = [server]
    print("Server started!")

    while inputs:
        readable, writeable, error = select.select(inputs,[],[])
        for s in readable:
            if s is server:
                conn, addr = s.accept()
                print('contact', addr, 'on', self.now())
                conn.setblocking(0)
                inputs.append(conn)
            else:
                data = s.recv(4096)
                if data:
                    print("Received msg: ", data.decode())
                else:
                    print('close')
                    inputs.remove(s)
                    s.close()
(请注意,除了打印数据和错误外,我还没有完成对接收数据的处理)

客户端使用空气插座进行连接。在基于Unix的系统上,一切似乎都正常工作。我已经测试过从Android手机和OSX系统发送数据

然而,在Windows客户端上,我可以连接,但我只在连接到服务器后的瞬间接收到一些东西(它发送一条测试消息)。 之后发送的所有内容都不会到达套接字服务器

我还尝试过使用socket.settimeout功能,但这会产生完全相同的问题。将AIR换成Flash,不同的版本也没什么区别。但考虑到OSX和Android上的一切都可以正常工作,我认为问题在于Windows

有人知道怎么解决这个问题吗? (我在AIR客户端PC上使用Windows 8。如果需要,我也可以发布AIR代码,但它非常基本,使用writeUTFBytes()发送消息)