module Protocol: sig end
Medium level UDP network protocol
exception Error of string
Exception raised when information given or received does not match protocol
type
t =
| |
I of int |
| |
C of char |
| |
F of float |
| |
S of string |
| |
List of t list |
Type that can be transferred through net. Examples of typing:
- "I" ->
I
- "IS" ->
I; S
- "S
C
" -> S; [C; C; ...; C]
- "C
IF
" -> C; [I; F; ...; I; F]
val c2s_add : string ->
(Udp.address -> t list -> unit) ->
Udp.socket -> t list -> unit
c2s_add params recv_fun
adds a new message to the protocol. The
* additional parameters transmitted with each message are specified in
* params
in format "ICCS
". add
also takse the fucntion called after
* having received the message and returns the sender of the message
val s2c_add : string ->
(t list -> unit) ->
Udp.socket -> Udp.address -> t list -> unit
val client_net_check : Udp.socket -> unit
client_net_check ()
checks the connection for received messages and
* calls all receivers.
val server_net_check : Udp.socket -> unit
server_net_check ()
checks the socket for new clients and for
* received messages. It also calls all receivers.