Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let server port =
- let inet_addr = inet_addr_any in
- let sockaddr = ADDR_INET (inet_addr, port) in
- let domain = domain_of_sockaddr sockaddr in
- Lwt_main.run (
- let%lwt _=Lwt_io.printf "started run\n" in
- let sock = Lwt_unix.socket domain SOCK_STREAM 0 in
- let%lwt _=Lwt_io.printf "sock created\n" in
- Lwt_unix.bind sock sockaddr;
- let%lwt _=Lwt_io.printf "bind done\n" in
- Lwt_unix.listen sock 10;
- let%lwt _=Lwt_io.printf "listen done, will Lwt.return call to accept_connection\n" in
- accept_connection sock)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement