I'm using socat to create a virtual serial port with:
socat PTY,link=/dev/ttySV0,echo=1 PTY,link=/dev/ttySV1,echo=1
The in my program written in C++, I open the ttySV1 port and start to read.
The read function is in a while, but the problem is that the read function hangs until I send data to the port. Do you know how to make the taht function not to hang and just exit if there is no data in the buffer?
EDIT: I send data to the port using:
echo [data] > /dev/ttySV0