Class Cf_sock_dgram.T.endpoint


class endpoint : t -> object .. end
Use new endpoint sock to construct an object derived from Cf_sock_common.T.basic that sports methods for sending data to one or more endpoints using the socket sock.
Inherits
method virtual getsockname : address_t
Use obj#getsockname to obtain the actual local address associated with the socket. Raises Unix.Error if there is an error.
method sendto : ?flags:Cf_socket.msg_flags_t -> string -> int -> int -> address_t -> int
Use self#sendto ?flags buf pos len addr to send len octets from the string buf starting at position pos to the remote address addr, and 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 recvfrom : ?flags:Cf_socket.msg_flags_t -> string -> int -> int -> int * address_t
Use recvfrom sock buf pos len flags to receive len octets into the string buf starting at position pos on the socket sock with the flags indicated by flags. Returns the number of octets actually received and the socket address of the remote endpoint that sent them. 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 connect : address_t -> unit
Use obj#connect to associate the socket with the remote address address. Enables the use of the getpeername, send and recv methods (may not be supported by all protocols).
method virtual getpeername : address_t
Use obj#getpeername to obtain the actual remote address associated with the socket. Raises Unix.Error if there is an error. If there is no remote address associated with the socket, then a protocol-specific response is provided. Most protocols will return an address indicated the remote address is unspecified.
method send : ?flags:Cf_socket.msg_flags_t -> string -> int -> int -> int
Use self#send ?flags buf pos len to send len octets from the string buf starting at position pos to the remote address previously associated with the socket using the connect method, and 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 from the remote address previously associated with the socket using the connect method, and 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 virtual 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.