[racket] port open or closed?

From: Jos Koot (jos.koot at telefonica.net)
Date: Thu Oct 20 09:35:39 EDT 2011

May be I am myopic, but I have not found any tools in the docs to check
whether a port is open or closed. After a port is closed, it may survive. It
would be handy to have:
1: a procedure that tells whether or not a port is open.
2: a procedure that given a closed port, reopens it or returns its path (or
other info about the port, for example, it may be an output-string or a
This can be useful for procedures that accept port arguments and want to
check first. Using some tricks I can make these procedures myself in a
rather stupid way that I rather would like to avoid (writing the port to an
output-string and inspect the output and displaying an empty string while
catching a port is closed exception)
Best wishes, Jos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20111020/2e16487e/attachment.html>

Posted on the users mailing list.