Module Socket

module Socket: sig  end
Medium level TCP interface.

The sockets offered by this module are comparable.

Every send message is read as a whole. (They are not divided and do not concatenate).

Operations provided by this module should not be mixed with the ones provided by Tcp

type t 
Type representing a single socket
val create : Tcp.socket -> t
Returns a socket associated with the given Tcp.socket.
val send : t -> string -> unit
send socket message sends the given message
val queue : t -> string -> unit
queue socket message adds the given message to send queue of socket
val flush : t -> unit
flush socket sends whole send queue of socket
val recv : t -> string list
recv socket message returns a list of messages received. (max 1 per call)
val force_recv : t -> string
force_recv socket is a blocking version of Socket.recv that waits for a message.
val destroy : t -> unit
destroy socket closes the socket and deletes its buffer at all