(define stream (open-tcp-stream-socket "localhost" 61613)) (format stream "CONNECT~%~%~A" #\NUL) (flush-output stream) (let loop ((line (read-line stream))) (cond ((not (string=? line (string #\NUL))) (loop (read-line stream))))) ; Skip the CONNECTED frame (format stream "SUBSCRIBE~%destination:SampleQueue~%ack:auto~%~%~A" #\NUL) (flush-output stream) (let loop ((line (read-line stream))) (cond ((not (string=? line "")) (loop (read-line stream))))) ; Seek to the body of the MESSAGE frame (display (read-line stream)) (format stream "DISCONNECT~%~%~A" #\NUL) (close-port stream)