Provide remote (network) access to a serial port. Built using the Qt Framework.
- Opens a serial port and connects bidirectional all active TCP streams (text mode)
- Accepts (no restrictions, no security considerations/precautions neither) incoming TCP connections
- Support local input
- Current limitations:
- Supported baud rates: 4800, 9600, 19200, 38400, 57600, 115200
- Immutable serial port parameters: 8N1 (8 data bits, no parity, one stop bit), no flow control
Tested on platforms:
- Debian 12 rc3 using Qt 6.4.2
- Ubuntu 20.04.1 LTS using Qt 5.12.8
- Ubuntu 16.04, 18.04 using Qt 5.5.1 / 5.7
- Raspberry Pi Model 3, Raspbian 9 (stretch) using Qt 5.7
- macOS Sierra (10.12.6), using Qt 5.10
- Windows 10, VS 2015 using Qt 5.7
$ ./serialTcp --help
Usage: ./serialTcp [options] serial-port serial-baud local-ip local-port
Open serial port and connect to all active TCP streams.
(https://github.com/Mokolea/serialTcp)
Options:
-h, --help Displays this help.
-v, --version Displays version information.
-l, --list-serial-ports List all currently available serial ports.
-i, --local-input Activate local input. (not implemented)
-o, --local-output Activate local output.
-m, --mode-binary TCP mode binary, default text (multi connection,
wait for <LF>).
Arguments:
serial-port Serial port this program is opening.
serial-baud Data baud rate for serial port, e.g. 115200 (8N1, no
flow control).
local-ip IP address this program is binding to, 'any' for any
interface.
local-port TCP port used by this program, listening.
$
List all currently available serial ports:
$ ./serialTcp -l
Serial ports:
'ttyUSB0'
'ttyS0'
$
Scenario 1: remote access logging information from a device (like Arduino, ...) attached to a serial port of Host A:
- Host A with serial port
/dev/ttyS0
(or/dev/ttyUSB0
, ...) and IP address192.168.1.100
- Host B connecting to serial port of host A
- Host C also connecting to serial port of host A
Host A: Prepare local serial port to be connected to from remote machines:
$ ./serialTcp ttyS0 115200 any 65432
Host B and C: Connect to serial port of host A:
$ nc 192.168.1.100 65432
On Linux you can also use socat
to access a serial port over TCP.
Example (see above): Host A:
$ socat TCP-LISTEN:65432,fork,reuseaddr FILE:/dev/ttyS0,115200,raw
MIT License
-- Mario