class type endpoint = object
.. end
The class type of network endpoints, i.e. objects containing socket
descriptors and the specific methods they support.
method fd : Unix.file_descr
Returns the Unix.file_descr
equivalent of the socket descriptor.
method send : ?flags:Cf_socket.msg_flags_t -> string -> int -> int -> int
Use obj#send ?flags buf pos len
to send len
octets from the string
buf
starting at position pos
, optionally with the flags indicated
by flags
. Returns the number of octets actually sent. Raises
Unix.Error
if there is an error. Raises Invalid_argument
if pos
and len
do not correspond to a valid substring of buf
.
method recv : ?flags:Cf_socket.msg_flags_t -> string -> int -> int -> int
Use obj#recv ?flags buf pos len
to receive len
octets to the string
buf
starting at position pos
, optionally with the flags indicated
by flags
. Returns the number of octets actually received. Raises
Unix.Error
if there is an error. Raises Invalid_argument
if pos
and len
do not correspond to a valid substring of buf
.
method shutdown : Unix.shutdown_command -> unit
Use obj#shutdown cmd
to shutdown either sending or receiving (or
both) on the socket. Raises Unix.Error
if there is an error.
method close : unit
Use obj#close
to close the socket. Raises Unix.Error
if there is an
error.