Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 7521

Advanced users • Re: Is there a serial equivalent to network's "localhost '?

$
0
0
What I want, primarily, is the serial equivalent of "localhost" ... (/dev/serial_localhost 😉 for example) that I could open in a python script and send data to it and then have the software under test open a serial connection to /dev/serial_localhost, 9600 8N1, and read the data as if it were a "real" serial port.
It is possible though I can't remember off-hand how to on a Pi. The trick is to have a pair of virtual serial ports. One you app accesses, say '/dev/serial_localhost', then another program can connect to the other, can read data sent by that app, send data back to your app.

The magic ingredient is whatever connects the two together. Maybe it's "netcat" on a Pi but I can't really remember. "com0com" does this on Windows so a search on that with "linux" added may help, as may "linux virtual serial ports".

Statistics: Posted by hippy — Mon Mar 17, 2025 5:49 pm



Viewing all articles
Browse latest Browse all 7521

Trending Articles