File: host.ml

package info (click to toggle)
ocaml-luv 0.5.10-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,888 kB
  • sloc: ml: 11,201; makefile: 6,102; sh: 4,385; ansic: 1,308; python: 38
file content (10 lines) | stat: -rw-r--r-- 328 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
let () =
  Luv.DNS.getaddrinfo ~family:`INET ~node:Sys.argv.(1) () begin function
    | Error e ->
      Printf.eprintf "Cannot resolve host: %s\n" (Luv.Error.strerror e)
    | Ok addr_infos ->
      print_endline
        (Option.get (Luv.Sockaddr.to_string (List.hd addr_infos).addr))
  end;

  ignore (Luv.Loop.run () : bool)