0

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.

0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.