Advertisement
Guest User

Untitled

a guest
Dec 20th, 2016
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
OCaml 0.52 KB | None | 0 0
  1. let server port =
  2.   let inet_addr = inet_addr_any in
  3.   let sockaddr = ADDR_INET (inet_addr, port) in
  4.   let domain = domain_of_sockaddr sockaddr in
  5.   Lwt_main.run (
  6.   let%lwt _=Lwt_io.printf "started run\n" in
  7.   let sock = Lwt_unix.socket domain SOCK_STREAM 0 in
  8.   let%lwt _=Lwt_io.printf "sock created\n" in
  9.   Lwt_unix.bind sock sockaddr;
  10.   let%lwt _=Lwt_io.printf "bind done\n"  in
  11.   Lwt_unix.listen sock 10;
  12.   let%lwt _=Lwt_io.printf "listen done, will Lwt.return call to accept_connection\n" in
  13.   accept_connection sock)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement