Virtual comport

Hi,

I want to make a simulator for a serial device.
When using node-red i can use the serial out node. But it is used to send information to an existing com or virtual com port.

Is there a way to make a virtual comport in node red? To which a second software can connect?

Assuming you are running Node-RED on Linux then you can use the socat command to create a pair of linked virtual serial port devices.

$ socat -d -d pty,raw,echo=0 pty,raw,echo=0
2013/11/01 13:47:27 socat[2506] N PTY is /dev/pts/2
2013/11/01 13:47:27 socat[2506] N PTY is /dev/pts/3
2013/11/01 13:47:27 socat[2506] N starting data transfer loop with FDs [3,3] and [5,5]

Where the 2 ports will be /dev/pts/2 and /dev/pts/3

3 Likes

No, my node red is mostly running on windows servers.

I found

I am going to try and work it out with an function node with this code in it.

Although socat is a good backup plan. Since there are some windows options for that as well it seems