blob: d4c706188f121c8af0d55dfd9e76cab31b1f8f4d [file] [log] [blame]
Guido van Rossum44f5c751998-01-29 04:04:04 +00001# Echo server demo using Unix sockets (handles one connection only)
2# Piet van Oostrum
Guido van Rossumdd918a91998-01-28 16:54:00 +00003from socket import *
4FILE = 'blabla'
5s = socket(AF_UNIX, SOCK_STREAM)
6s.bind(FILE)
7print 'Sock name is: ['+s.getsockname()+']'
8s.listen(1)
9conn, addr = s.accept()
10print 'Connected by', addr
11while 1:
12 data = conn.recv(1024)
13 if not data: break
14 conn.send(data)
15conn.close()