chickadee » socket » socket-receive-ready?

socket-receive! so buf #!optional (start 0) (end #f) (flags 0)procedure
socket-receive-ready? soprocedure

Receives data from socket so and writes it into buf, which may be a string or a blob. start and end are optional offsets into buf; the call attempts to read end - start = len bytes. If end is #f, it is interpreted as the end of the blob or string.

This call will block until data is available, but other threads can proceed. If the receive does not complete within socket-receive-timeout milliseconds, a timeout error is raised. To avoid blocking the current thread, you can check if data is ready via socket-receive-ready?.

Returns the number of bytes actually received (and updates buf as a side effect).

For datagram sockets, if len is smaller than the amount of data in the next datagram, the rest of the data is irrevocably lost.