Module Udp


module Udp: sig  end
Low level UDP network access

exception Error of string
Exception Error is raised when the operating system cannot compleat the requested operation, for example "Out of memory"
type socket 
Type representing either a connected or a listening (bound) UDP socket
type address 
Type representing the net address of a host used to recognize clients
val connect : string -> int -> socket
connect hostname port creates a socket ready to send to specified host. You need to send without providing destination address or to use module Protocol.
val poll : socket -> float -> bool
poll sock timeout checks if any new messages arrived to the given socket.
val send : socket -> ?dest:address -> string -> int -> int -> unit
send sock to msg pos len sends given message to host connected with sock or to given destination.
Raises Error if sock is not connected and dest is not given.
val recv : socket -> string -> int -> int -> int * address
recv sock msg pos len returns number of bytes read and who sent it. It mat return (0, _) if no data recved
val create_socket : int -> socket
new_socket port creates a listening socket on the given port.
val close : socket -> unit
close sock should be used to disconnect or unbind the given socket
val describe_connection : address -> string
describe_connection address returns a string representation of the given net address address.