kolibrios/programs/develop/tinypy/examples/net/echosrv.py
jaeger fa03894a53 tinypy: particularly debugged network support.
git-svn-id: svn://kolibrios.org@2110 a494cfbc-eb01-0410-851d-a64ba20cac60
2011-08-23 21:42:01 +00:00

15 lines
285 B
Python

import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(('192.168.1.101', 5000))
s.listen(1)
conn, addr = s.accept()
print("Connected by ", addr)
while True:
data = conn.recv(1024)
if not data:
break
print(data)
conn.send(data)
conn.close()