Python Forum

Full Version: Async server/client
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello! I have that 2 small programs 1 for server and 1 for client:


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 break
Client:
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!
Ok, thanks a lot!