package obus
Module OBus_serverSource
Servers for one-to-one communication
Type of a server
addresses server returns all the addresses the server is listenning on. These addresses must be passed to clients so they can connect to server.
shutdown server shutdowns the given server. It terminates when all listeners (a server may listen on several addresses) have exited. If the server has already been shut down, it does nothing.
val make :
?switch:Lwt_switch.t ->
?capabilities:OBus_auth.capability list ->
?mechanisms:OBus_auth.Server.mechanism list ->
?addresses:OBus_address.t list ->
?allow_anonymous:bool ->
(t -> OBus_connection.t -> unit) ->
t Lwt.tmake ?switch ?capabilities ?mechanisms ?addresses ?allow_anonymous f Creates a server which will listen on all of the given addresses.
About errors:
- if no addresses are provided, it raises
Invalid_argument, - if an address is invalid, it raises
Invalid_argument - if listening fails for one of the addresses, it fails with the exception reported for that address
It succeeds if it can listen on at least one address.
When a new client connects, the server handles authentication of this client, then it creates a transport and the connection on top of this transport.
Note that connections passed to f are initially down. It is up to the user to set them up with OBus_connection.set_up.
val make_lowlevel :
?switch:Lwt_switch.t ->
?capabilities:OBus_auth.capability list ->
?mechanisms:OBus_auth.Server.mechanism list ->
?addresses:OBus_address.t list ->
?allow_anonymous:bool ->
(t -> OBus_transport.t -> unit) ->
t Lwt.tmake_lowlevel is the same as make except that f receives only the transport, and no connection is created for this transport.