Sending/Receiving Multiple Message over TCP in Python
问题 I want to send/receive messages multiple TCP messages between the server and the client. For Example: Server: ip="" port=8888 buffersize=1024 s=socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind((myIP, myPort)) s.listen(1) (cl, adress) = s.accept() cl.send("hi!".encoded()) msg=cl.recv(bufferSize).decode() msg=msg[0] print(" Received message is '{}'".format(msg)) Client: ip="" port=8888 s=socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect(ip,port) msg=s.recv(1024).decode() print