i am about to use nc + xxd to debug a network process. the process
under test, say process P1, will send/receive binary data
( datagrams ) to/from another process, say process P2, via tcp socket.

so, i have nc act as the P2 as below,
nc -s -l -p 9000 | xxd -g1
by this way i can see what sent from P1. thanks xxd ! but the
problem is, how can i have P2 send some datagrams back to P1? i need
to both directly inject the binary data stream and input some
datagrams in hexadecimal text format ( just as the form in which xxd
outputs ).

i once came out with a solution,
nc -s -l -p 9000 < my.input | xxd -g1\
but it never work since after nc opened the my.input, what i did on
the file will not get know by the nc. any idea? thanks in advance.