Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Transport GClasses

Low-level network and serial I/O. All transport GClasses use io_uring for non-blocking operations.

Source: kernel/c/root-linux/src/c_tcp.c, c_tcp_s.c, c_udp.c, c_udp_s.c, c_uart.c


C_TCP

TCP transport — client and client-of-server. Supports optional TLS/SSL.

PropertyValue
StatesST_STOPPED, ST_DISCONNECTED, ST_WAIT_STOPPED, ST_WAIT_CONNECTED, ST_WAIT_HANDSHAKE, ST_CONNECTED
Input eventsEV_CONNECT, EV_TX_DATA, EV_DROP, EV_TIMEOUT
Output eventsEV_CONNECTED, EV_DISCONNECTED, EV_RX_DATA, EV_TX_READY

Key attributes

AttributeTypeDescription
urlstringConnection URL (e.g. tcp://host:port, ssl://host:port).
connectedboolCurrent connection state (volatile, read-only).
use_sslboolEnable TLS on the connection.
cryptojsonTLS configuration (certificates, keys).
rx_buffer_sizeintegerReceive buffer size in bytes.
timeout_inactivityintegerInactivity timeout in seconds (-1 = no timeout).
txBytesintegerTotal bytes transmitted (stat).
rxBytesintegerTotal bytes received (stat).
peernamestringRemote peer address (read-only).
socknamestringLocal socket address (read-only).

Usage

Typically used as the bottom gobj of a protocol GClass (C_PROT_TCP4H, C_WEBSOCKET, etc.) or directly inside a C_CHANNEL.


C_TCP_S

TCP server — listens on a URL and accepts connections. Creates a child C_TCP (inside a C_CHANNEL) for each accepted client.

PropertyValue
StatesST_STOPPED, ST_IDLE
Input eventsEV_CONNECTED, EV_DISCONNECTED, EV_RX_DATA, EV_TX_READY, EV_DROP, EV_STOPPED
Output eventsEV_CONNECTED, EV_DISCONNECTED, EV_RX_DATA, EV_TX_READY

Key attributes

AttributeTypeDescription
urlstringListening URL (e.g. tcp://0.0.0.0:1234).
backlogintegerListen backlog.
sharedboolEnable port sharing (SO_REUSEPORT).
cryptojsonTLS configuration for accepted connections.
only_allowed_ipsboolRestrict connections to allowed IPs only.
connxsintegerCurrent connection count (stat).
tconnxsintegerTotal connection count (stat).
clisrv_kwjsonExtra kw passed to each child client/server.

Commands

CommandDescription
helpShow available commands.
view-servicesList connected client channels.

C_UDP

UDP client transport — send and receive datagrams.

PropertyValue
StatesST_STOPPED, ST_DISCONNECTED, ST_CONNECTED
Input eventsEV_CONNECT, EV_TX_DATA, EV_DROP, EV_TIMEOUT
Output eventsEV_CONNECTED, EV_DISCONNECTED, EV_RX_DATA, EV_TX_READY

Key attributes

AttributeTypeDescription
urlstringConnection URL.
rx_buffer_sizeintegerReceive buffer size.
txBytes / rxBytesintegerByte counters (stats).
txMsgs / rxMsgsintegerMessage counters (stats).

C_UDP_S

UDP server — listens for datagrams on a configured URL.

PropertyValue
StatesST_STOPPED, ST_IDLE
Input eventsEV_RX_DATA, EV_TX_DATA, EV_STOPPED
Output eventsEV_RX_DATA

Key attributes

AttributeTypeDescription
urlstringListening URL.
sharedboolEnable port sharing.
set_broadcastboolEnable broadcast.
only_allowed_ipsboolRestrict to allowed IPs only.
rx_buffer_sizeintegerReceive buffer size.

C_UART

Serial port (UART/TTY) transport.

PropertyValue
StatesST_STOPPED, ST_DISCONNECTED, ST_WAIT_CONNECTED, ST_CONNECTED
Input eventsEV_CONNECT, EV_TX_DATA, EV_DROP, EV_TIMEOUT
Output eventsEV_CONNECTED, EV_DISCONNECTED, EV_RX_DATA

Key attributes

AttributeTypeDescription
urlstringDevice path (e.g. /dev/ttyUSB0).
baudrateintegerBaud rate (default 115200).
bytesizeintegerData bits (58, default 8).
paritystringParity: "N", "E", "O".
stopbitsintegerStop bits (1 or 2).
xonxoffboolSoftware flow control.
rtsctsboolHardware flow control.