<!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="previous" href="Versioned_rpc.html"> <link rel="next" href="Weak_hashtbl.html"> <link rel="Up" href="index.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</title> </head> <body> <div class="navbar"><a class="pre" href="Versioned_rpc.html" title="Versioned_rpc">Previous</a> <a class="up" href="index.html" title="Index">Up</a> <a class="post" href="Weak_hashtbl.html" title="Weak_hashtbl">Next</a> </div> <h1>Module <a href="type_Versioned_typed_tcp.html">Versioned_typed_tcp</a></h1> <pre><span class="keyword">module</span> Versioned_typed_tcp: <code class="code">sig</code> <a href="Versioned_typed_tcp.html">..</a> <code class="code">end</code></pre><div class="info module top"> This module describes the type of a given direction of message flow. For example it might describe the type of messages from the client to the server.<br> </div> <hr width="100%"> <pre><span id="VAL__pa_ounit_275876e34cf609db118f3d84b799a790"><span class="keyword">val</span> __pa_ounit_275876e34cf609db118f3d84b799a790</span> : <code class="type">string</code></pre> <pre><span id="EXCEPTIONBigsubstring_allocator_got_invalid_requested_size"><span class="keyword">exception</span> Bigsubstring_allocator_got_invalid_requested_size</span> <span class="keyword">of</span> <code class="type">int</code></pre> <pre><span id="VALbigsubstring_allocator"><span class="keyword">val</span> bigsubstring_allocator</span> : <code class="type">?initial_size:int -> unit -> Core.Std.Int.t -> Core.Std.Bigsubstring.t</code></pre> <pre><span class="keyword">module type</span> <a href="Versioned_typed_tcp.Name.html">Name</a> = <code class="code">sig</code> <a href="Versioned_typed_tcp.Name.html">..</a> <code class="code">end</code></pre> <pre><span id="TYPEmarshal_fun"><span class="keyword">type</span> <code class="type">'a</code> marshal_fun</span> = <code class="type">'a -> Core.Std.Bigsubstring.t option</code> </pre> <pre><span id="TYPEunmarshal_fun"><span class="keyword">type</span> <code class="type">'a</code> unmarshal_fun</span> = <code class="type">Core.Std.Bigsubstring.t -> 'a option</code> </pre> <pre><span id="VALprotocol_version"><span class="keyword">val</span> protocol_version</span> : <code class="type">[ `Prod | `Test ] Pervasives.ref</code></pre> <pre><span class="keyword">module</span> <a href="Versioned_typed_tcp.Version.html">Version</a>: <code class="code">sig</code> <a href="Versioned_typed_tcp.Version.html">..</a> <code class="code">end</code></pre> <pre><span class="keyword">module type</span> <a href="Versioned_typed_tcp.Versions.html">Versions</a> = <code class="code">sig</code> <a href="Versioned_typed_tcp.Versions.html">..</a> <code class="code">end</code></pre> <pre><span class="keyword">module type</span> <a href="Versioned_typed_tcp.Datumable.html">Datumable</a> = <code class="code">sig</code> <a href="Versioned_typed_tcp.Datumable.html">..</a> <code class="code">end</code></pre><div class="info"> This module describes the type of a given direction of message flow. </div> <pre><span class="keyword">module type</span> <a href="Versioned_typed_tcp.Datum.html">Datum</a> = <code class="code">sig</code> <a href="Versioned_typed_tcp.Datum.html">..</a> <code class="code">end</code></pre> <pre><span class="keyword">module type</span> <a href="Versioned_typed_tcp.Mode.html">Mode</a> = <code class="code">sig</code> <a href="Versioned_typed_tcp.Mode.html">..</a> <code class="code">end</code></pre><div class="info"> This module may be used to implement modes for clients/servers. </div> <pre><span class="keyword">module</span> <a href="Versioned_typed_tcp.Dont_care_about_mode.html">Dont_care_about_mode</a>: <code class="code">sig</code> <a href="Versioned_typed_tcp.Dont_care_about_mode.html">..</a> <code class="code">end</code></pre> <pre><span class="keyword">module</span> <a href="Versioned_typed_tcp.Read_result.html">Read_result</a>: <code class="code">sig</code> <a href="Versioned_typed_tcp.Read_result.html">..</a> <code class="code">end</code></pre> <pre><span class="keyword">module</span> <a href="Versioned_typed_tcp.Server_msg.html">Server_msg</a>: <code class="code">sig</code> <a href="Versioned_typed_tcp.Server_msg.html">..</a> <code class="code">end</code></pre> <pre><span class="keyword">module</span> <a href="Versioned_typed_tcp.Client_msg.html">Client_msg</a>: <code class="code">sig</code> <a href="Versioned_typed_tcp.Client_msg.html">..</a> <code class="code">end</code></pre> <pre><span class="keyword">module type</span> <a href="Versioned_typed_tcp.Arg.html">Arg</a> = <code class="code">sig</code> <a href="Versioned_typed_tcp.Arg.html">..</a> <code class="code">end</code></pre> <pre><span class="keyword">module type</span> <a href="Versioned_typed_tcp.S.html">S</a> = <code class="code">sig</code> <a href="Versioned_typed_tcp.S.html">..</a> <code class="code">end</code></pre> <pre><span class="keyword">module</span> <a href="Versioned_typed_tcp.Make.html">Make</a>: <div class="sig_block"><code class="code">functor (</code><code class="code">Z</code><code class="code"> : </code><code class="type"><a href="Versioned_typed_tcp.Arg.html">Arg</a></code><code class="code">) -> </code><code class="code">sig</code> <a href="Versioned_typed_tcp.Make.html">..</a> <code class="code">end</code></div></pre> <pre><span class="keyword">module</span> <a href="Versioned_typed_tcp.Datumable_of_binable.html">Datumable_of_binable</a>: <code class="code">sig</code> <a href="Versioned_typed_tcp.Datumable_of_binable.html">..</a> <code class="code">end</code></pre><div class="info"> Helpers to make your types Datumable if they are binable. </div> <br> This module describes the type of a given direction of message flow. For example it might describe the type of messages from the client to the server.<br> <br> <code class="code">lookup_marshal_fun v</code> This function takes a version <code class="code">v</code>, and returns a function that will downgrade (if necessary) the current version to <code class="code">v</code> and then write it to a bigsubstring. It is perfectly fine if one message becomes zero or more messages as a result of downgrading, this is why the marshal fun returns a list. The contents of these buffers will be copied immediatly, so it is safe to reuse the same bigstring for multiple marshals.<br> <br> <code class="code">lookup_unmarshal_fun v</code> This function takes a version <code class="code">v</code>, and returns a function that unmarshals a message and upgrades it, returning zero or more messages as a result of the upgrade. The bigsubstring is only guaranteed to contain valid data until the unmarshal function returns, after which it may be overwritten immediatly.<br> <br> This module may be used to implement modes for clients/servers. A common scheme is to have two modes, Test, and Production, and to want to maintain the invariant that clients in mode Test may not talk to servers in mode Production, and that clients in mode Production may not talk to servers in mode Test. Versioned connection will check that the mode of the client is the same as the mode of the server. <p> If you don't care about modes, just use Dont_care_about_mode.<br> <br> create a new server, and start listening<br> <br> defualt: Scheduler.cycle_start<br> <br> remote names must be unique<br> <br> <code class="code">warn_when_free_connections_lte_pct</code>. If the number of free connections falls below this percentage of max connections an Almost_full event will be generated. The default is 5%. It is required that 0.0 <= warn_when_free_connections_lte_pct <= 1.0<br> <br> max connected clients. default 500<br> <br> get the port that the server is listening on<br> <br> <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> <br> <code class="code">listen t</code> listen to the stream of messages and errors coming from clients<br> <br> <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> <br> <code class="code">send t client msg</code> send <code class="code">msg</code> to <code class="code">client</code>.<br> <br> <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> <br> <code class="code">send_to_all t msg</code> send the same message to all connected clients.<br> <br> sent successfuly to all clients<br> <br> not sent successfully to any client<br> <br> sent to some clients<br> <br> <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> <br> <code class="code">send_to_some t msg names</code> send the same message to multiple connected clients.<br> <br> sent successfuly to all clients<br> <br> not sent successfully to any client<br> <br> sent to some clients<br> <br> <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> <br> create a new (initially disconnected) client<br> <br> defualt: Scheduler.cycle_start<br> <br> remote name must match expected remote name.<br> <br> <code class="code">connect t</code> If the connection is not currently established, initiate one.<br> <br> If a connection is currently established, close it. Also, if we're trying to connect, give up.<br> <br> <code class="code">listen t</code><br> <br> <code class="code">listen_ignore_errors t</code> like <code class="code">listen</code>, but with no errors or meta data. 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 stop), so you should not call it many times throwing away the result. If you need to do this use listen.<br> <br> <code class="code">send t msg</code> send a message to the server. If the connection is not currently established, initiate one.<br> <br> <code class="code">send_ignore_errors t</code> exactly like <code class="code">send</code> but with no error reporting.<br> <br> <code class="code">state t</code><br> <br> <code class="code">last_connect_error t</code> returns the error (if any) that happened on the last connection attempt.<br> <br> sent successfuly to all clients<br> <br> not sent successfully to any client<br> <br> sent to some clients<br> <br> sent successfuly to all clients<br> <br> not sent successfully to any client<br> <br> sent to some clients<br> <br> Helpers to make your types Datumable if they are binable. Works with up to 5 versions (easily extensible to more)<br> </body></html>