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.
| Property | Value |
|---|
| States | ST_STOPPED, ST_DISCONNECTED, ST_WAIT_STOPPED, ST_WAIT_CONNECTED, ST_WAIT_HANDSHAKE, ST_CONNECTED |
| Input events | EV_CONNECT, EV_TX_DATA, EV_DROP, EV_TIMEOUT |
| Output events | EV_CONNECTED, EV_DISCONNECTED, EV_RX_DATA, EV_TX_READY |
Key attributes¶
| Attribute | Type | Description |
|---|
url | string | Connection URL (e.g. tcp://host:port, ssl://host:port). |
connected | bool | Current connection state (volatile, read-only). |
use_ssl | bool | Enable TLS on the connection. |
crypto | json | TLS configuration (certificates, keys). |
rx_buffer_size | integer | Receive buffer size in bytes. |
timeout_inactivity | integer | Inactivity timeout in seconds (-1 = no timeout). |
txBytes | integer | Total bytes transmitted (stat). |
rxBytes | integer | Total bytes received (stat). |
peername | string | Remote peer address (read-only). |
sockname | string | Local 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.
| Property | Value |
|---|
| States | ST_STOPPED, ST_IDLE |
| Input events | EV_CONNECTED, EV_DISCONNECTED, EV_RX_DATA, EV_TX_READY, EV_DROP, EV_STOPPED |
| Output events | EV_CONNECTED, EV_DISCONNECTED, EV_RX_DATA, EV_TX_READY |
Key attributes¶
| Attribute | Type | Description |
|---|
url | string | Listening URL (e.g. tcp://0.0.0.0:1234). |
backlog | integer | Listen backlog. |
shared | bool | Enable port sharing (SO_REUSEPORT). |
crypto | json | TLS configuration for accepted connections. |
only_allowed_ips | bool | Restrict connections to allowed IPs only. |
connxs | integer | Current connection count (stat). |
tconnxs | integer | Total connection count (stat). |
clisrv_kw | json | Extra kw passed to each child client/server. |
Commands¶
| Command | Description |
|---|
help | Show available commands. |
view-services | List connected client channels. |
C_UDP¶
UDP client transport — send and receive datagrams.
| Property | Value |
|---|
| States | ST_STOPPED, ST_DISCONNECTED, ST_CONNECTED |
| Input events | EV_CONNECT, EV_TX_DATA, EV_DROP, EV_TIMEOUT |
| Output events | EV_CONNECTED, EV_DISCONNECTED, EV_RX_DATA, EV_TX_READY |
Key attributes¶
| Attribute | Type | Description |
|---|
url | string | Connection URL. |
rx_buffer_size | integer | Receive buffer size. |
txBytes / rxBytes | integer | Byte counters (stats). |
txMsgs / rxMsgs | integer | Message counters (stats). |
C_UDP_S¶
UDP server — listens for datagrams on a configured URL.
| Property | Value |
|---|
| States | ST_STOPPED, ST_IDLE |
| Input events | EV_RX_DATA, EV_TX_DATA, EV_STOPPED |
| Output events | EV_RX_DATA |
Key attributes¶
| Attribute | Type | Description |
|---|
url | string | Listening URL. |
shared | bool | Enable port sharing. |
set_broadcast | bool | Enable broadcast. |
only_allowed_ips | bool | Restrict to allowed IPs only. |
rx_buffer_size | integer | Receive buffer size. |
C_UART¶
Serial port (UART/TTY) transport.
| Property | Value |
|---|
| States | ST_STOPPED, ST_DISCONNECTED, ST_WAIT_CONNECTED, ST_CONNECTED |
| Input events | EV_CONNECT, EV_TX_DATA, EV_DROP, EV_TIMEOUT |
| Output events | EV_CONNECTED, EV_DISCONNECTED, EV_RX_DATA |
Key attributes¶
| Attribute | Type | Description |
|---|
url | string | Device path (e.g. /dev/ttyUSB0). |
baudrate | integer | Baud rate (default 115200). |
bytesize | integer | Data bits (5–8, default 8). |
parity | string | Parity: "N", "E", "O". |
stopbits | integer | Stop bits (1 or 2). |
xonxoff | bool | Software flow control. |
rtscts | bool | Hardware flow control. |