<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <link rel="stylesheet" href="style.css" type="text/css"> <meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> <link rel="Start" href="index.html"> <link rel="next" href="Versioned_typed_tcp.S.Client.html"> <link rel="Up" href="Versioned_typed_tcp.S.html"> <link title="Index of types" rel=Appendix href="index_types.html"> <link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> <link title="Index of values" rel=Appendix href="index_values.html"> <link title="Index of modules" rel=Appendix href="index_modules.html"> <link title="Index of module types" rel=Appendix href="index_module_types.html"> <link title="Command" rel="Chapter" href="Command.html"> <link title="File_tail" rel="Chapter" href="File_tail.html"> <link title="File_writer" rel="Chapter" href="File_writer.html"> <link title="Import" rel="Chapter" href="Import.html"> <link title="Lock_file" rel="Chapter" href="Lock_file.html"> <link title="Log" rel="Chapter" href="Log.html"> <link title="Persistent_singleton" rel="Chapter" href="Persistent_singleton.html"> <link title="Rpc" rel="Chapter" href="Rpc.html"> <link title="Rpc_intf" rel="Chapter" href="Rpc_intf.html"> <link title="Std" rel="Chapter" href="Std.html"> <link title="Tcp" rel="Chapter" href="Tcp.html"> <link title="Tcp_file" rel="Chapter" href="Tcp_file.html"> <link title="Typed_tcp" rel="Chapter" href="Typed_tcp.html"> <link title="Typed_tcp_intf" rel="Chapter" href="Typed_tcp_intf.html"> <link title="Unpack_sequence" rel="Chapter" href="Unpack_sequence.html"> <link title="User_and_group" rel="Chapter" href="User_and_group.html"> <link title="Versioned_rpc" rel="Chapter" href="Versioned_rpc.html"> <link title="Versioned_typed_tcp" rel="Chapter" href="Versioned_typed_tcp.html"> <link title="Weak_hashtbl" rel="Chapter" href="Weak_hashtbl.html"><title>Versioned_typed_tcp.S.Server</title> </head> <body> <div class="navbar"> <a class="up" href="Versioned_typed_tcp.S.html" title="Versioned_typed_tcp.S">Up</a> <a class="post" href="Versioned_typed_tcp.S.Client.html" title="Versioned_typed_tcp.S.Client">Next</a> </div> <h1>Module <a href="type_Versioned_typed_tcp.S.Server.html">Versioned_typed_tcp.S.Server</a></h1> <pre><span class="keyword">module</span> Server: <code class="code">sig</code> <a href="Versioned_typed_tcp.S.Server.html">..</a> <code class="code">end</code></pre><hr width="100%"> <pre><span id="TYPEt"><span class="keyword">type</span> <code class="type"></code>t</span> </pre> <pre><span class="keyword">include</span> Invariant.S</pre> <pre><span id="VALcreate"><span class="keyword">val</span> create</span> : <code class="type">?logfun:<a href="Versioned_typed_tcp.S.html#TYPElogfun">Versioned_typed_tcp.S.logfun</a> -><br> ?now:(unit -> Core.Std.Time.t) -><br> ?enforce_unique_remote_name:bool -><br> ?is_client_ip_authorized:(string -> bool) -><br> ?warn_when_free_connections_lte_pct:float -><br> ?max_clients:int -><br> listen_port:int -><br> My_name.t -> <a href="Versioned_typed_tcp.S.Server.html#TYPEt">t</a> Import.Deferred.t</code></pre><div class="info "> create a new server, and start listening<br> </div> <pre><span id="VALport"><span class="keyword">val</span> port</span> : <code class="type"><a href="Versioned_typed_tcp.S.Server.html#TYPEt">t</a> -> int</code></pre><div class="info "> get the port that the server is listening on<br> </div> <pre><span id="VALclose"><span class="keyword">val</span> close</span> : <code class="type"><a href="Versioned_typed_tcp.S.Server.html#TYPEt">t</a> -> Remote_name.t -> unit</code></pre><div class="info "> <code class="code">close t client</code> close connection to <code class="code">client</code> if it exists. This does not prevent the same client from connecting again later.<br> </div> <pre><span id="VALlisten"><span class="keyword">val</span> listen</span> : <code class="type"><a href="Versioned_typed_tcp.S.Server.html#TYPEt">t</a> -><br> (Remote_name.t, Recv.t) <a href="Versioned_typed_tcp.Server_msg.html#TYPEt">Versioned_typed_tcp.Server_msg.t</a> Import.Stream.t</code></pre><div class="info "> <code class="code">listen t</code> listen to the stream of messages and errors coming from clients<br> </div> <pre><span id="VALlisten_ignore_errors"><span class="keyword">val</span> listen_ignore_errors</span> : <code class="type">?stop:unit Import.Deferred.t -><br> <a href="Versioned_typed_tcp.S.Server.html#TYPEt">t</a> -> Recv.t Import.Stream.t</code></pre><div class="info "> <code class="code">listen_ignore_errors t</code> like listen, but omit error conditions and metadata. When listen_ignore_errors is called it installs a filter on the stream that never goes away (unless t is destroyed, or you provide a <code class="code">stop</code>).<br> </div> <pre><span id="VALsend"><span class="keyword">val</span> send</span> : <code class="type"><a href="Versioned_typed_tcp.S.Server.html#TYPEt">t</a> -><br> Remote_name.t -><br> Send.t -> [ `Dropped | `Sent of Core.Std.Time.t ] Import.Deferred.t</code></pre><div class="info "> <code class="code">send t client msg</code> send <code class="code">msg</code> to <code class="code">client</code>.<br> <b>Returns</b> a deferred that will become determined when the message has been sent. In the case of an error, the message will be dropped, and the deferred will be filled with <code class="code">`Dropped</code> (meaning the message was never handed to the OS), otherwise it will be filled with with <code class="code">`Sent tm</code> where tm is the time (according to Time.now) that the message was handed to the operating system. It is possible that the deferred will never become determined, for example in the case that the other side hangs, but does not drop the connection.<br> </div> <pre><span id="VALsend_ignore_errors"><span class="keyword">val</span> send_ignore_errors</span> : <code class="type"><a href="Versioned_typed_tcp.S.Server.html#TYPEt">t</a> -> Remote_name.t -> Send.t -> unit</code></pre><div class="info "> <code class="code">send_ignore_errors t client msg</code> Just like send, but does not report results. Your message will probably be sent successfully sometime after you call this function. If you receive a <code class="code">Disconnect</code> error on the listen channel in close time proximity to making this call then your message was likely dropped.<br> </div> <pre><span id="VALsend_to_all"><span class="keyword">val</span> send_to_all</span> : <code class="type"><a href="Versioned_typed_tcp.S.Server.html#TYPEt">t</a> -><br> Send.t -> [ `Dropped | `Partial_success | `Sent ] Import.Deferred.t</code></pre><div class="info "> <code class="code">send_to_all t msg</code> send the same message to all connected clients.<br> </div> <pre><span id="VALsend_to_all_ignore_errors"><span class="keyword">val</span> send_to_all_ignore_errors</span> : <code class="type"><a href="Versioned_typed_tcp.S.Server.html#TYPEt">t</a> -> Send.t -> unit</code></pre><div class="info "> <code class="code">send_to_all_ignore_errors t msg</code> Just like <code class="code">send_to_all</code> but with no error reporting.<br> </div> <pre><span id="VALsend_to_some"><span class="keyword">val</span> send_to_some</span> : <code class="type"><a href="Versioned_typed_tcp.S.Server.html#TYPEt">t</a> -><br> Send.t -><br> Remote_name.t list -><br> [ `Dropped | `Partial_success | `Sent ] Import.Deferred.t</code></pre><div class="info "> <code class="code">send_to_some t msg names</code> send the same message to multiple connected clients.<br> </div> <pre><span id="VALsend_to_some_ignore_errors"><span class="keyword">val</span> send_to_some_ignore_errors</span> : <code class="type"><a href="Versioned_typed_tcp.S.Server.html#TYPEt">t</a> -> Send.t -> Remote_name.t list -> unit</code></pre><div class="info "> <code class="code">send_to_some_ignore_errors t msg</code> Just like <code class="code">send_to_some</code> but with no error reporting.<br> </div> <pre><span id="VALclient_send_version"><span class="keyword">val</span> client_send_version</span> : <code class="type"><a href="Versioned_typed_tcp.S.Server.html#TYPEt">t</a> -><br> Remote_name.t -> Versioned_typed_tcp.Version.t option</code></pre> <pre><span id="VALflushed"><span class="keyword">val</span> flushed</span> : <code class="type"><a href="Versioned_typed_tcp.S.Server.html#TYPEt">t</a> -><br> cutoff:unit Import.Deferred.t -><br> ([ `Flushed of Remote_name.t list ] * [ `Not_flushed of Remote_name.t list ])<br> Import.Deferred.t</code></pre></body></html>