Add support for IPv4 and IPv6 network sockets

Add support for IPv4 and IPv6 network sockets via socket syntax
"inet:<port>" and "inet6:<port>" respectively.

For example, to listen and redirect serial device I/O to a host bound
IPv4 socket simply do:

 $ tio /dev/ttyUSB0 --socket inet:4444

To connect do e.g.:

 $ nc 127.0.0.1 4444

Likewise, for IPv6 do:

 $ tio /dev/ttyUSB0 --socket inet6:4444

To connect do e.g.:

 $ nc ::1 4444

If port is 0 or no port is provided default port 3333 is used.
This commit is contained in:
Martin Lund 2022-06-11 13:59:59 +02:00
parent ba22191800
commit 17e96d70bc
2 changed files with 136 additions and 19 deletions

View file

@ -140,13 +140,21 @@ sequences are not recognized), and any input from the serial port is multiplexed
Sockets remain open while the serial port is disconnected, and writes will block.
Two socket types are supported using different prefixes in the socket field:
unix:<filename> - Unix Domain Socket (file)
inet:<IP>:<port> - Internet Socket (network) (NOT YET SUPPORTED)
The following socket types are supported using different prefixes in the socket field:
.RS
.TP 20n
.IP "\fBunix:<filename>"
Unix Domain Socket (file)
.IP "\fBinet:<port>"
Internet Socket (network)
.IP "\fBinet6:<port>"
Internet IPv6 Socket (network)
.P
If port is 0 or no port is provided default port 3333 is used.
.P
At present there is a hardcoded limit of 16 clients connected at one time.
.RE
.TP
.BR \-v ", " \-\-version