I'm trying to create a bridge between TCP server and a client connected thorough a serial port using socat.

I emulate my TCP server with the following command

socat tcp-listen:8888,reuseaddr -

I emulate the serial device with a pty. To create a simple brigde with the following command:

socat -d -d TCP:localhost:8888 pty,rawer

This works fine but, I want to log the contents of the messages between the two devices.

I have tried to do this with the following command:

socat -d -d TCP:localhost:8888 SYSTEM:'tee server.log | socat -d -d - pty | tee client.log' 

This seems to work fine but my problem is that I get an echo on the server side.

1 Answer 1


It's turns out the solution was easier than I expect just adding the -v options logs what it's being sent between the client and the server with to stderr. In my example it will be the following:

socat -v TCP:localhost:8888 pty,rawer &> com.log

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .