6
votes

for testing purpose I'm trying to write a simple program that connect to a virtual serial port created with socat.

I create the serial port with this command:

socat -d -d PTY,b9600 PTY,link=ttyVS1,b9600

getting this output:

2011/11/08 18:26:31 socat[32708] N PTY is /dev/pts/1
2011/11/08 18:26:31 socat[32708] N PTY is /dev/pts/2
2011/11/08 18:26:31 socat[32708] N starting data transfer loop with FDs [3,3] and [5,5]

When I try to connect in this way:

System.IO.Ports.SerialPort _port;
_port = new SerialPort("/dev/pts/1", 9600);
_port.Open();

I get a "filename unknown" System.IO.IOException.

Am I missing to set DataBits, StopBits or other parameters? How can I discover the properties sett by socat? Or what is wrong with this code?

1
Nothing related but just to mention ,at my Native Language Socat means "Retarded" =)Rosmarine Popcorn

1 Answers

1
votes

What is wrong here is for sure the name of the device. Can you check at /dev that /dev/pts/1 exists? Maybe it has another name like /dev/pts1?