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:
3001:raw:0:/dev/ttyAT3:9600 NONE 1STOPBIT 8DATABITS -XONXOFF -LOCAL -RTSCTS
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:10.99.99.99:3001 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.