Up

module Lwt_cstruct

: sig

Blocking Lwt functions to read and write from Cstruct buffers.

#
val read : Lwt_unix.file_descr -> Cstruct.t -> int Lwt.t

read fd t reads data from the file descriptor fd into the t cstruct.

Returns the numbers of bytes actually read.
#
val write : Lwt_unix.file_descr -> Cstruct.t -> int Lwt.t

write fd t writes data from the t cstruct to the file descriptor fd.

Returns the numbers of bytes actually written.
#
val complete : (Cstruct.t -> int Lwt.t) -> Cstruct.t -> unit Lwt.t

complete (read fd) t fills t with data from fd.

complete (write fd) t fully-writes t to fd.

Raises End_of_file if the file descriptor operation fails.
#
val sendto : Lwt_unix.file_descr -> Cstruct.t -> Unix.msg_flag list -> Unix.sockaddr -> int Lwt.t

sendto fd t flags sa invokes Lwt_unix.sendto on the t cstruct.

Returns the number of bytes sent.
#
val recvfrom : Lwt_unix.file_descr -> Cstruct.t -> Unix.msg_flag list -> (int * Unix.sockaddr) Lwt.t

recvfrom fd t flags sa invokes Lwt_unix.recvfrom on the t cstruct.

Returns the number of bytes read and the socket address of the remote side.
end