Up

Module Net_utils

Networking utilities

Author Markus Mottl <mmottl@janestreet.com>

Signature

exception Timeout

Exception raised if a connection attempt timed out

val h_name_of_sockaddr : Unix.sockaddr -> string

Get hostname from sockaddr

val string_of_sockaddr : Unix.sockaddr -> string

Get string from sockaddr

val h_name_or_string_of_sockaddr : Unix.sockaddr -> string

Get hostname or (on Not_found) inet string from sockaddr

val inet_addr_of_sockaddr : Unix.sockaddr -> Unix.inet_addr

Get inet_addr from sockaddr

val port_of_sockaddr : Unix.sockaddr -> int

Get port from sockaddr

val port_of_in_channel : Pervasives.in_channel -> int

Get port from a socket associated with an in_channel

val tcp_socket : unit -> Unix.file_descr

Create a standard TCP/IP-socket

val connect_tmout : Unix.file_descr -> Unix.sockaddr -> Core.Std.Unix.select_timeout -> bool

Connect a socket with a connect timeout

val open_fd_connection_tmout : con_timeout:Core.Std.Unix.select_timeout -> rcv_timeout:float -> snd_timeout:float -> Unix.sockaddr -> Unix.file_descr

Create a socket with timeouts

val open_connection_tmout : con_timeout:Core.Std.Unix.select_timeout -> rcv_timeout:float -> snd_timeout:float -> Unix.sockaddr -> Pervasives.in_channel * Pervasives.out_channel

Open a connection with timeouts

val set_in_channel_timeout : Pervasives.in_channel -> float -> unit

Set a timeout for a socket associated with an in_channel

val set_out_channel_timeout : Pervasives.out_channel -> float -> unit

Set a timeout for a socket associated with an out_channel