Channels and Transport
A channel (IChannel) only moves bytes. It does not parse Modbus, MC, S7, or custom frames. Protocols sit above channels, so the same device code can move between serial, TCP, UDP, and virtual channels.
States
| State | Meaning |
|---|---|
Created | Registered but not opened |
Opening | Opening a port or establishing a connection |
Open | Read/write is allowed |
Faulted | Open or write failed |
Closed | Closed |
Calling OpenAsync on an already open channel is harmless. Calling it on Closed or Faulted cleans up the previous transport before reopening. Explicit CloseAsync does not auto-reconnect; the host retries only after Faulted according to ChannelReconnectOptions.
Events
StateChanged: channel state changed; failures includeError.DataReceived: a safe copy of received bytes; may run outside the UI thread.PacketTraced: raw TX/RX packets with direction, timestamp, and hex payload for diagnostics.
Implementations
| Type | Purpose |
|---|---|
SerialPortChannel | Serial port |
TcpClientChannel | TCP client |
TcpServerChannel | TCP server; replies to the most recent client by default |
UdpClientChannel | UDP client |
UdpServerChannel | UDP server; replies to the most recent remote endpoint by default |
VirtualChannel | In-memory echo channel, optionally backed by an IVirtualResponder |
To application code they are all IChannel. See Serial Port, TCP / UDP, Virtual Channel, and Communication Tracing.