Socket_read

Function Socket_read 

Source
pub unsafe extern "C" fn Socket_read(
    self_: Socket,
    buf: *mut u8,
    size: c_int,
) -> c_int
Expand description

read from socket to local buffer (non-blocking)

The function shall return immediately if no data is available. In this case the function returns 0. If an error happens the function shall return -1.

Implementation of this function is MANDATORY

NOTE: The behaviour of this function changed with version 0.8!

§Arguments

  • self - the client, connection or server socket instance
  • buf - the buffer where the read bytes are copied to
  • size - the maximum number of bytes to read (size of the provided buffer)

§Returns

the number of bytes read or -1 if an error occurred