I think the simplest way to do this would be with `read-bytes-evt` and `sync/timeout`:
(sync/timeout 1 (read-bytes-evt 50 port)) This reads 50 bytes (or to eof, if that's less than 50) from port, with a timeout of 1 second. On Thu, May 31, 2012 at 6:28 AM, Rüdiger Asche <[email protected]> wrote: > Hi there everybody, > > I'm not sure if this hasn't been discussed before (at least didn't find any > reference in google), so apologies if this should be a dupe: > > How do I set a read timeout on a port (in this case, a TCP port)? In native > socket API, it's done via setsockopt() but the socket option set is > naturally shielded from application programmers. I couldn't find a hint > about timeouting read in the documentation for file I/O which the port > concept is a part of. > > Thanks! > > > > ____________________ > Racket Users list: > http://lists.racket-lang.org/users -- sam th [email protected] ____________________ Racket Users list: http://lists.racket-lang.org/users

