import socket server_address = /tmp/test.sock # Sicherstellen daß der Socket nicht existiert try: os.unlink(server_address) except OSError: if os.path.exists(server_address): raise sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) sock.bind(server_address) sock.listen(1) while True: connection, client_address = sock.accept() try: while True: data = connection.recv(16) if data: pass else: break finally: connection.close()