Category Archives: Programming

Serial to serial over network (ser2net,socat)

This setup is a small testing example I made at work. We have a bluetooth modem on a small controller, on /dev/ttyAT3. I wanted to debug a piece of software that must interface with that serial port, but on my development PC, instead of transferring the software to the board.

First, ser2net is configured on the controller, for forwarding /dev/ttyAT3 to an IP socket:


The above config for ser2net routes ttyAT3 to a socket on port 3001.

Now, on the development PC, I need to route the remote socket to a local, virtual serial port. For this I use socat:

socat -d -d TCP4: PTY:

Now socat routes the remote socket to a /dev/pts/? device! and I can debug my application ash though it had access to the actual /dev/ttyAT3 on the controller.

socat could of course be used on the controller as well, instead of ser2net.