[racket] Keyboard polling and user packages

From: Neil Van Dyke (neil at neilvandyke.org)
Date: Sun Aug 10 11:09:46 EDT 2014

If you haven't already, you can try the following to disable any port 
buffering within Racket, but that doesn't help you if the OS (Windows 
and Posix-ish console stuff it's doing from the console window) isn't 
giving Racket raw, unbuffered access to keyboard input through stdin:

     (file-stream-buffer-mode my-port 'none)

If you were using almost anything other than Windows, you could just use 

Other than that, you or someone could make a portable Racket 
text-terminal package that does stuff like uses the console API on 
Windows and tty on almost everything else.

BTW, you mention getting random bytes with variations on "read-bytes".  
That simply shouldn't happen with "read-bytes", but, when using 
variations on "read-bytes-avail!", only the first N count bytes it says 
it read will be valid in the bytestring.

Neil V.

Posted on the users mailing list.