def receive_connection():
 server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
 server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
 server.bind(('localhost', 8080))
 server.listen(1)
 client = server.accept()[0]
 server.close()
 return client

def receive_connection ( ) : server = socket . socket ( socket . AF_INET , socket . SOCK_STREAM ) server . setsockopt ( socket . SOL_SOCKET , socket . SO_REUSEADDR , 1 ) server . bind ( ( 'localhost' , 8080 ) ) server . listen ( 1 ) client = server . accept ( ) [ 0 ] server . close ( ) return client
wait for and then return a connected socket .