let port_of_string port = try try (getservbyname port "tcp").s_port with Not_found -> int_of_string port with _ -> raise (Failure "port_of_string");; let thread_nb = 10;; let main () = if Array.length Sys.argv <> 2 then begin prerr_endline ("Usage: "^Sys.argv.(0)^" port"); exit 1 end else try establish_fixed_thread_number_server thread_nb execute_query (port_of_string Sys.argv.(1)) with Failure "port_of_string" -> prerr_endline ("Unknown port: "^Sys.argv.(2)); exit 2;; handle_unix_error main () |