The pair of programs (in single executable) demonstrating AF_UNIX socket
feature of sharing file descriptors.
-
Transmit file content.
Start receiver on
/tmp/socket:recvfd /tmp/socketSend file:
sendfd -f input.txt /tmp/socket -
Send specific descriptor.
Start receiver on
/tmp/socket:recvfd /tmp/socketOpen descriptor using
exec(manpage):exec 3< input.txtSend it:
sendfd -d 3 /tmp/socket -
Resend descriptor to the other program.
Start receiver on
/tmp/socketwith-eswitch and provide command to start child:recvfd -e -s /tmp/socket -- python3 -c 'print("first line:", input())'Send something:
echo "hello python" | sendfd /tmp/socket