May-29-2017, 10:08 AM
Hello! I have that 2 small programs 1 for server and 1 for client:
Server:
How can I write the code to make it (the server side) asyncronous?
Thansk a lot!
Server:
import socket serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) serversocket.bind(('localhost', 8089)) serversocket.listen(5) # become a server socket, maximum 5 connections while True: connection, address = serversocket.accept() buf = connection.recv(64) if len(buf) > 0: print buf breakClient:
import socket clientsocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) clientsocket.connect(('localhost', 8089)) clientsocket.send('hello')But that code is syncronous.
How can I write the code to make it (the server side) asyncronous?
Thansk a lot!