I have multiple serial device servers for a home automation system. I need to be able to create multiple (5 or 6) virtual com ports. I am guessing there is a way to do this with socat but so far I haven't figured it out or found any examples.

The command below works well but only for one virtual port. As a test, I've tried creating multiple instances using different terminals and the second instance fails.

socat -d -d pty,link=/dev/ttyV00,raw,echo=0 tcp:

Ideally I can have another instance linking to ttyV01 for a different ip. Something like

socat -d -d pty,link=/dev/ttyV02,raw,echo=0 tcp:

After much searching I found some examples here at the Homeseer website.

From what I have learned you can add the & to the end of the socat command and it will run the socat in the background. I believe it is the way Ubuntu evaluates commands using the && ; and &.

Here are the 2 commands that are currently redirecting 2 virtual pty ports to different IP address and running in the background successfully.

sudo socat PTY,link=/dev/ttyV00,mode=777,echo=0,ignoreeof,b115200,raw TCP: &

sudo socat PTY,link=/dev/ttyV01,mode=777,echo=0,ignoreeof,b115200,raw TCP: &

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.