When reading over a socket, clisp reads a carriage-return/line-feed character _pair_ as a #\Newline character (single). After returning the #\Newline, (listen mysock) still reports T even when there is nothing left to return. This does not happen if reading from a string directly.
(setq foo (concatenate 'string "any thing here" (string (code-char 13)) (string (code-char 10))))
(with-input-from-string (is gak) (loop while (listen is) collect (read-char is)))
;; reports correctly, but if you send gak over a socket and read from the socket, it will read a #\Newline (skipping over the #\Return) but (listen sock) will report T
;; with the result that any read hangs waiting for input which is not there although listen indicated there was something.
Log in to post a comment.