diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2022-09-09 16:52:28 +0200 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2022-09-09 16:52:28 +0200 |
commit | 38495d423f23b145a4377f87a536db5d2721f814 (patch) | |
tree | 61087a4c5e4138873cc4e6e0f9eeb4ac22d617e2 /examples/echo_srv.py | |
parent | ccb717ac524bb8a5c49ae92710864d022eebb401 (diff) |
Cleaned up repository, moved files where they belong to.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'examples/echo_srv.py')
-rw-r--r-- | examples/echo_srv.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/examples/echo_srv.py b/examples/echo_srv.py new file mode 100644 index 0000000..b3855eb --- /dev/null +++ b/examples/echo_srv.py @@ -0,0 +1,16 @@ +import socket + +HOST = '127.0.0.1' +PORT = 9095 + +with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: + s.bind((HOST, PORT)) + s.listen() + conn, addr = s.accept() + with conn: + while True: + data = conn.recv(1024) + print('recvd: {} bytes'.format(len(data))) + if len(data) == 0: + break; + conn.sendall(data) |