Package: socat
Severity: wishlist
X-Debbugs-Cc: so...@dest-unreach.org
Forwarded: so...@dest-unreach.org

socat does not appear to have a way to send data to multiple clients of
a listening socket, which would be useful to proxy data from overloaded
servers to multiple local clients.

For example:

   socat TCP-CONNECT:1.2.3.4:1234 UNIX-LISTEN:sock,unlink-early=1 &
   socat UNIX-CONNECT:out STDOUT &
   socat UNIX-CONNECT:out STDOUT &

The second client is not allowed to connect to the socket:

   2024/05/01 13:12:32 socat[957352] E connect(, AF=1 "out", 5): Connection 
refused

This can be achieved, by using this nmap ncat command:

   ncat --listen --unixsock out --keep-open --send-only

This appears to work by reading some data, then writing it
to all the client sockets, then repeating the process.

Unfortunately ncat breaks when one of the clients terminates,
so ncat currently does not appear to be useful for this yet.

   Ncat: Program bug: fd (4) not on list. QUITTING.

PS: some places on the web where people are looking for this feature,
for both local Unix domain stream sockets and local TCP ports:

https://serverfault.com/questions/747980/simpliest-unix-non-blocking-broadcast-socket
https://unix.stackexchange.com/questions/195880/socat-duplicate-stdin-to-each-connected-client
https://stackoverflow.com/questions/17480967/using-socat-to-multiplex-incoming-tcp-connection
https://gist.github.com/mathieue/3505472

-- 
bye,
pabs

https://wiki.debian.org/PaulWise

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to