3

I have a unix socket server:

s = socket(AF_UNIX, SOCK_DGRAM)
s.bind(socket_name)

while True:
    data, addr = s.recvfrom(0x1000)
    s.sendto(process(data), addr)

This does not work, it seems addr is an empty string.
How can I make this send the response back? I do not want the clients having to name the client socket.
I could use SOCK_STREAM with listen and accept but I want message based delivery and not stream based.

Daniel
  • 30,896
  • 18
  • 85
  • 139
  • Possible duplicate: http://stackoverflow.com/questions/7325468/how-to-make-two-directional-unix-domain-sockets-with-sock-dgram – Robᵩ Dec 09 '16 at 21:20
  • 1
    Related: http://stackoverflow.com/questions/9644251/how-do-unix-domain-sockets-differentiate-between-multiple-clients – Robᵩ Dec 09 '16 at 21:26
  • 1
    Even though it is C not python but this question explain how to solve the problem: Possible duplicate of [C unix domain sockets, recvfrom() doesn't set struct sockaddr\* src\_addr](http://stackoverflow.com/questions/26706584/c-unix-domain-sockets-recvfrom-doesnt-set-struct-sockaddr-src-addr) – Steffen Ullrich Dec 09 '16 at 21:39

0 Answers0