From 2f13c228385fa1d95d23edaa18d4a9e32033aaa5 Mon Sep 17 00:00:00 2001 From: Marco Castelluccio Date: Wed, 15 Oct 2014 15:01:30 -0700 Subject: [PATCH] Simple Python echo server --- tests/echoServer.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 tests/echoServer.py diff --git a/tests/echoServer.py b/tests/echoServer.py new file mode 100755 index 00000000..2da3d4eb --- /dev/null +++ b/tests/echoServer.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python + +import socket + +s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) +s.bind(('', 50003)) +s.listen(5) + +while True: + client, address = s.accept() + + while True: + data = client.recv(1024) + + if data: + client.send(data) + else: + break; + + client.close()