I have a problem with monitoring data transferred between 3D printer and software over TCP.

I have 3D printer that is connected to Raspberry pi with usb cable. I'm using ser2net in rasbperry to forward the serial port data from printer through tcp to my laptop where I'm running the printer software and which is in the same network as Rasperry. In my laptop I use socat to mount virtual serial port (ttyACM1) which listens the data from forwarded serial port in rasberry. So far this works pretty well and I'm able to use software in my laptop to use printer remotely.

But now I have problem when I'm trying to monitor the data that I'm sending from the software to the printer. I have tried to use different softwares to sniff serial port data, but every time I run these softwares it disconnects the connection between printer software and virtual serial port.

So how can I at the same time use software and sniff the data that I'm sending from the software to printer without canceling the connection between virtual port and the software.

Here are the command and softwares I'm using in this setup:

In rasperry printer is connected to ttyACM0



In my laptop:

$sudo socat pty,raw,echo=0,link=/dev/ttyACM1 tcp: (in /dev/ there is now ttyACM1->/dev/pts/30 appeared)

And when I try for example interceptty:

$sudo interceptty /dev/ttyACM1

to sniff data when the printer software is running it says that printer is disconnected. I can still read the data from the ttyACM1 using interceptty. And when I close interceptty it will find the printer again.

Is there a way to sniff the data while using printer?

  • 1
    I figured it out. I used socat /dev/ttyACM0,raw,echo=0 SYSTEM:'tee input.txt | socat - "PTY,link=/dev/ttyACM1,raw,echo=0,waitslave" | tee output.txt' in raspberry to connect ttyACM0 to PTY ttyACM1 as was told in [link] (unix.stackexchange.com/questions/12359/…). Then I forwarded this virtual port traffic over tcp to my laptop. I was then able to use printer software and at the same time sniff data traffic between printer and my laptop by tailing input.txt and output.txt files.
    – Toni
    Oct 4 '16 at 9:46

Your Answer

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

Browse other questions tagged or ask your own question.