How to make send() call asynchronous?
问题 Server is running as nc -l 1234 Below is the client that is not blocked on recv() using event loop's select() call. client.py import socket import sys from eventloop import EventLoop class Connection(): def __init__(self): self.sock = socket.socket() self.sock.connect(('localhost', 1234)) def fileno(self): return self.sock.fileno() def onRead(self): msg = self.sock.recv(1000).decode('utf-8') print(msg) def send(self, msg): self.sock.send(msg) class Input(): def __init__(self, sock): self.sock