Hi Jeff,

On Thursday, June 30, 2022 at 8:34:44 PM UTC+2 Jeff Henrikson wrote:

> How do I accept an inbound TCP connection so that once I am processing 
> it, if the connection is broken by the client or network, my program 
> promptly finds out? 

You can use `tcp-listen` and `tcp-accept` [0] to accept connections. Once 
accepted, the connection appears as a matched pair of ports, one for input 
and one for output, and if the connection breaks, the ports will be closed 
as usual. In some circumstances, you will get an exception such as 
"connection reset" (see `exn:fail:network`). If you need to reliably 
distinguish closed-by-peer, all-ok from closed-by-weird-network-weather, 
your application protocol has to handle that, there's nothing TCP can do 
for you there. HTTP does this via content-length and/or chunking, for 


[0]: https://docs.racket-lang.org/reference/tcp.html

You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 

Reply via email to