/usr/share/mozart/doc/system/node51.html is in mozart-doc 1.4.0-8ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>16 Locating services in a network: Discovery</TITLE><LINK href="ozdoc.css" rel="stylesheet" type="text/css"></HEAD><BODY><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node50.html#chapter.resolve"><< Prev</A></TD><TD><A href="index.html">- Up -</A></TD><TD><A href="node52.html#chapter.fault">Next >></A></TD></TR></TABLE><DIV id="chapter.discovery"><H1><A name="chapter.discovery">16 Locating services in a network: <CODE>Discovery</CODE></A></H1><H3 class="authors"><A href="http://www.sics.se/~andreas">Andreas Sundström</A></H3><P> In order to make it easier to find a <A name="label598"></A><EM>service</EM> (an Oz server application) one might want to have some sort of yellow pages, or a directory. While a directory is easy to implement in Oz, the <CODE>Discovery</CODE> module allows to locate it in a local area network. </P><DIV class="danger"><P class="margin"><IMG align="top" alt="Danger" src="danger.gif"></P><P> The current implementation may be incomplete on certain platforms. Notably, only on Linux and Solaris it is guaranteed that broadcasts are sent to all the available networks. On other platforms this depends on the operating system. </P></DIV><P> The <CODE>Discovery</CODE> service consists of two parts, a server and a client. The server is initialized with a value. The server waits for inquiries from clients and sends the value as an answer. The client sends a broadcast message to all available networks (for example, ethernet and ip over serial link). Then the client waits for answers from servers. </P><P> A value the server holds would typically be a <A name="label599"></A><EM>ticket</EM> to an Oz port that a directory server listens to. </P><DIV id="section.discovery.module"><H2><A name="section.discovery.module">16.1 The Module</A></H2><P> The module has three features: </P><DL><DT><CODE>server</CODE> <A name="label601"></A> </DT><DD><P>The server class. </P></DD><DT><CODE>client</CODE> <A name="label603"></A> </DT><DD><P>The client class. </P></DD><DT><CODE>defaultServerPort</CODE> <A name="label605"></A> </DT><DD><P>The number of the default ip port that the server listens to. </P></DD></DL><P> </P><P> The server class <A name="label606"></A><SPAN class="index"><CODE>Discovery<SPAN class="keyword">.</SPAN>server</CODE></SPAN> has following methods: </P><P> </P><DL><DT><A name="label607"></A><SPAN class="index"><CODE>init</CODE></SPAN> <A name="label608"></A> </DT><DD><BLOCKQUOTE class="synopsis"><P><CODE>init(info:</CODE><CODE><I>Info</I></CODE><CODE> port:</CODE><CODE><I>PortNr</I></CODE><CODE> <SPAN class="keyword"><=</SPAN> </CODE><CODE><I>DefaultServerPort</I></CODE><CODE>)</CODE> </P></BLOCKQUOTE></DD><DD><P><CODE><I>Info</I></CODE> is the answer to be send on request by clients. It must be a virtual string. The server listens to the ip port <CODE><I>PortNr</I></CODE>. If the field <CODE>port</CODE> is not present, the default port number will be used. </P></DD><DT><A name="label609"></A><SPAN class="index"><CODE>replace</CODE></SPAN> <A name="label610"></A> </DT><DD><BLOCKQUOTE class="synopsis"><P><CODE>replace(info:Info)</CODE> </P></BLOCKQUOTE></DD><DD><P>Replaces the answer to be send to clients. </P></DD><DT><A name="label611"></A><SPAN class="index"><CODE>close</CODE></SPAN> <A name="label612"></A> </DT><DD><BLOCKQUOTE class="synopsis"><P><CODE>close()</CODE> </P></BLOCKQUOTE></DD><DD><P>Closes the operation of the server. </P></DD></DL><P> </P><P> The client class <A name="label613"></A><SPAN class="index"><CODE>Discovery<SPAN class="keyword">.</SPAN>client</CODE></SPAN> has following methods: </P><P> </P><DL><DT><A name="label614"></A><SPAN class="index"><CODE>init</CODE></SPAN> <A name="label615"></A> </DT><DD><BLOCKQUOTE class="synopsis"><P><CODE>init(port:</CODE><CODE><I>ServerPortNr</I></CODE><CODE> <SPAN class="keyword"><=</SPAN> </CODE><CODE><I>DefaultServerPort</I></CODE><CODE>)</CODE> </P></BLOCKQUOTE></DD><DD><P>This method broadcasts a message. Answers to that message can be obtained using the methods <CODE>getOne</CODE> and <CODE>getAll</CODE>. The port that the server listens can be specified as <CODE><I>ServerPortNr</I></CODE>. If the field <CODE>port</CODE> is not present, the default port number will be used. </P></DD><DT><A name="label616"></A><SPAN class="index"><CODE>getOne</CODE></SPAN> <A name="label617"></A> </DT><DD><BLOCKQUOTE class="synopsis"><P><CODE>getOne(timeOut:</CODE><CODE><I>TimeOut</I></CODE><CODE> <SPAN class="keyword"><=</SPAN> 1000 info:?</CODE><CODE><I>Info</I></CODE><CODE>)</CODE> </P></BLOCKQUOTE></DD><DD><P>There could be several servers listening to broadcasts from a client, therefore there can be several answers. If an answer is received before <CODE><I>TimeOut</I></CODE> milliseconds the variable <CODE><I>Info</I></CODE> will hold that answer. Otherwise <CODE><I>Info</I></CODE> will be <CODE>timeout</CODE>. Answers are Oz strings. </P><P> Instead of a time in milliseconds <CODE><I>TimeOut</I></CODE> can be <CODE>inf</CODE>. This means that the method will suspend until an answer is received (or forever if no answer is received). </P><P> If this method is called again the next answer (if such answer exists) will be returned. </P></DD><DT><A name="label618"></A><SPAN class="index"><CODE>getAll</CODE></SPAN> <A name="label619"></A> </DT><DD><BLOCKQUOTE class="synopsis"><P><CODE>getAll(timeOut:</CODE><CODE><I>TimeOut</I></CODE><CODE> <SPAN class="keyword"><=</SPAN> 1000 info:?</CODE><CODE><I>Info</I></CODE><CODE>)</CODE> </P></BLOCKQUOTE></DD><DD><P>Method <CODE>getAll</CODE> can be used instead of method <CODE>getOne</CODE>. After calling this method, <CODE><I>Info</I></CODE> will hold a list of all answers received before <CODE><I>TimeOut</I></CODE> milliseconds has gone by. </P><P> This method is implemented using <CODE>getOne</CODE>. So any answers fetched by calling <CODE>getOne</CODE> will not reappear in the list <CODE><I>Info</I></CODE>, and vice versa. </P><P> <CODE><I>TimeOut</I></CODE> can be <CODE>inf</CODE> here too. In this case a stream will be returned instead of a list. </P></DD><DT><A name="label620"></A><SPAN class="index"><CODE>close</CODE></SPAN> <A name="label621"></A> </DT><DD><BLOCKQUOTE class="synopsis"><P><CODE>close()</CODE> </P></BLOCKQUOTE></DD><DD><P>Closes the operation of the client class. </P></DD></DL><P> </P></DIV></DIV><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node50.html#chapter.resolve"><< Prev</A></TD><TD><A href="index.html">- Up -</A></TD><TD><A href="node52.html#chapter.fault">Next >></A></TD></TR></TABLE><HR><ADDRESS><A href="http://www.ps.uni-sb.de/~duchier/">Denys Duchier</A>, <A href="http://www.ps.uni-sb.de/~kornstae/">Leif Kornstaedt</A>, <A href="http://www.ps.uni-sb.de/~homik/">Martin Homik</A>, <A href="http://www.ps.uni-sb.de/~tmueller/">Tobias Müller</A>, <A href="http://www.ps.uni-sb.de/~schulte/">Christian Schulte</A> and <A href="http://www.info.ucl.ac.be/~pvr">Peter Van Roy</A><BR><SPAN class="version">Version 1.4.0 (20110908185330)</SPAN></ADDRESS></BODY></HTML>
|