pub async fn serve_tcp(hub: Arc<Hub>, listener: TcpListener) -> Result<()>Available on crate feature
hub only.Expand description
Accept GridConnect TCP clients forever.
Spawns a task per client running run_gridconnect_stream, with
TCP_NODELAY set. Port 12021 is the conventional GridConnect hub port
(JMRI’s default).
A failed accept (for example “too many open files”) is logged, followed
by a 100 ms pause, and the loop continues; one bad moment does not take
the listener down.
§Errors
None in practice: the function only returns if the runtime shuts it
down. The io::Result return type is kept so it composes with ? and
tokio::spawn the same way as before.