Permalink
Browse files

Add Lwt_cstruct.{recvfrom,read}

  • Loading branch information...
1 parent 0ca03b6 commit 126ea39f0644d35962ffeeb2499b3e0804fb8aa7 David Scott committed Dec 20, 2012
Showing with 10 additions and 0 deletions.
  1. +6 −0 lwt/lwt_cstruct.ml
  2. +4 −0 lwt/lwt_cstruct.mli
View
@@ -14,8 +14,14 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*)
+let read fd t =
+ Lwt_bytes.read fd t.Cstruct.buffer t.Cstruct.off t.Cstruct.len
+
let write fd t =
Lwt_bytes.write fd t.Cstruct.buffer t.Cstruct.off t.Cstruct.len
let sendto fd t flags dst =
Lwt_bytes.sendto fd t.Cstruct.buffer t.Cstruct.off t.Cstruct.len flags dst
+
+let recvfrom fd t flags =
+ Lwt_bytes.recvfrom fd t.Cstruct.buffer t.Cstruct.off t.Cstruct.len flags
View
@@ -15,6 +15,10 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*)
+val read: Lwt_unix.file_descr -> Cstruct.t -> int Lwt.t
+
val write: Lwt_unix.file_descr -> Cstruct.t -> int Lwt.t
val sendto: Lwt_unix.file_descr -> Cstruct.t -> Unix.msg_flag list -> Unix.sockaddr -> int Lwt.t
+
+val recvfrom: Lwt_unix.file_descr -> Cstruct.t -> Unix.msg_flag list -> (int * Unix.sockaddr) Lwt.t

0 comments on commit 126ea39

Please sign in to comment.