Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let rec accept_connection sock =
- let socket_thread = Lwt_unix.accept sock in
- Lwt.bind socket_thread
- ( fun (fd, caller) ->
- ignore(Lwt_io.printf "accepted\n%!");
- (* works *)
- (*
- ignore (readall fd >>= (fun a ->
- ignore(Lwt_io.printf "readall result\n%!");
- ignore(Lwt_io.printf "%s\n%!" a);
- Lwt_unix.close fd ;));
- *)
- (* works *)
- (* Warning 10: this expression should have type unit. *)
- (*
- Lwt.bind (readall fd)
- (fun a ->
- ignore(Lwt_io.printf "readall result\n%!");
- ignore(Lwt_io.printf "%s\n%!" a);
- Lwt.return(Lwt_unix.close fd );) ;
- *)
- (* does not work : *)
- (*
- readall fd >>= fun a -> Lwt_io.printf "readall result\n %s\n%!" a >>= fun () -> Lwt_unix.close fd >>= fun () ->
- *)
- accept_connection sock;
- );;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement