Hello, I'm trying to set up a server that receives data on a Unix domain socket using the code below.
import os from socketserver import UnixStreamServer, StreamRequestHandler SOCKET = '/tmp/test.socket' class Handler(StreamRequestHandler): def handle(self): data = selr.rfile.read() print(data) if os.path.exists(SOCKET): os.unlink(SOCKET) with UnixStreamServer(SOCKET, Handler) as server: server.serve_forever() However, when I try to send somthing to that socket, I get this error message: $ echo "Hello" | socat - UNIX-SENDTO:/tmp/test.socket 2021/03/22 11:03:22 socat[2188] E sendto(5, 0x55a22f414990, 6, 0, AF=1 "/tmp/test.socket", 18): Protocol wrong type for socket I don't understand that error. Here's /tmp/test.socket: $ stat /tmp/test.socket File: ‘/tmp/test.socket’ Size: 0 Blocks: 0 IO Block: 4096 socket Device: fd00h/64768d Inode: 201443577 Links: 1 Access: (0775/srwxrwxr-x) Uid: ( 1001/ dh) Gid: ( 1001/ dh) Context: unconfined_u:object_r:user_tmp_t:s0 Access: 2021-03-22 09:47:49.516298102 +0100 Modify: 2021-03-22 09:47:49.516298102 +0100 Change: 2021-03-22 09:47:49.516298102 +0100 Birth: - Sadly all examples I can find on the web are for TCP sockets, not Unix domain. Any tips? robert -- https://mail.python.org/mailman/listinfo/python-list