Paste number 134381: tcp6 egg ignores timeout parameter

Index of paste annotations: 1

Paste number 134381: tcp6 egg ignores timeout parameter
Pasted by: sethalves
When:10 years, 2 months ago
Share:Tweet this! | http://paste.lisp.org/+2VOT
Channel:None
Paste contents:
Raw Source | XML | Display As
#!/usr/local/bin/csi -script

(use tcp6)
(use srfi-18)

(tcp-read-timeout #f)

(thread-start!
 (make-thread
  (lambda ()
    (let ((listen-sock (tcp-listen 55555 4 "localhost")))
      (let-values (((in-port out-port) (tcp-accept listen-sock)))
        (let loop ()
          (let ((line (read-line in-port)))
            (cond ((eof-object? line) #t)
                  (else
                   (display "got a line: ")
                   (display line)
                   (newline)
                   (loop))))))))))


(thread-sleep! 5)
(let-values (((read-port write-port)
              (tcp-connect "localhost" 55555)))
  (display "okay\n" write-port)
  (flush-output write-port)
  (thread-sleep! 65)
  (display "still okay\n" write-port)
  (flush-output write-port)
  (thread-sleep! 5)
  (close-input-port read-port)
  (close-output-port write-port))

Annotations for this paste:

Annotation number 1: untitled
Pasted by: noname
When:10 years, 2 months ago
Share:Tweet this! | http://paste.lisp.org/+2VOT/1
Paste contents:
Raw Source | Display As
got a line: okay

Warning (#<thread: thread34>): (socket-receive!) operation timed out
60000
284

        Call history:

        <eval>    ((##core#letrec ((loop (##core#loop-lambda () (let ((line (read-line in-port))) (cond ((eof-object? ......
        <eval>    (read-line in-port)
        <eval>    (eof-object? line)
        <eval>    (display "got a line: ")
        <eval>    (display line)
        <eval>    (newline)
        <eval>    (loop)
        <eval>    (read-line in-port)   <--

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.