Le 2015-12-06 21:38, Marko Rauhamaa a écrit : > Guile 2.0.11 provides: > > get-bytevector-n > get-bytevector-n! > get-bytevector-some > > Of these, only get-bytevector-some seems to behave as expected when the > port is nonblocking: First thanks for pointing the correct way to setup a non-blocking port. I was missing that bit in my code. I can't make work `get-bytevector-some` with my code. It only returns a single cell bv. Instead I use `char-ready?`. Here is the definition of `recv-some`: ``` (define (recv-some port) (let next ((out '())) (if (char-ready? port) (let ((byte (get-u8 port))) (if (eof-object? byte) (u8-list->bytevector (reverse out)) (next (cons byte out)))) (u8-list->bytevector (reverse out))))) ``` FWIW, i also have a send-all procedure that works around the fact that the socket is non blocking: ``` (define (send-all socket message cc) (let loop ((message message)) (let* ((count (send socket message)) (message (bytevector-drop message count))) (if (eq? (bytevector-length message) 0) (cc) (loop-add-writer socket (lambda () (loop message))))))) ``` `loop-add-writer` register a thunk to be run when the socket is ready for writes. I attached tests files.