Skip to main content

Module tcp

Module tcp 

Source
Expand description

Serial-over-TCP transport: tcp://host:port.

Talks raw bytes to a TCP serial bridge (ser2net in raw mode, ESP-Link, Moxa/USR device servers, socat TCP-LISTEN:… /dev/ttyUSB0). Works on every platform, including iOS, which has no local serial API. Line settings (baud, parity, …) and modem lines are stored but not sent: a raw bridge has its own port settings.

TCP keepalive is on with a short idle time, so a bridge that vanished without a FIN (power cut, Wi-Fi drop) fails the next read within about KEEPALIVE_IDLE + KEEPALIVE_RETRIES * KEEPALIVE_INTERVAL and the hub reports Disconnect, instead of the port timing out quietly forever.

Structs§

TcpSerialPort

Constants§

TCP_SCHEME

Functions§

tcp_address
tcp://host:port → host:port, or None for an ordinary device path.