1
0
mirror of https://github.com/ubf/ubf.git synced 2026-04-20 03:35:59 +00:00
Files
ubf/edoc/proc_socket_server.html
Joseph Wayne Norton fcc41fd711 update edocs
2010-04-13 23:33:22 +09:00

130 lines
5.9 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Module proc_socket_server</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="EDoc">
</head>
<body bgcolor="white">
<div class="navbar"><a name="#navbar_top"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
<hr>
<h1>Module proc_socket_server</h1>
<ul class="index"><li><a href="#description">Description</a></li><li><a href="#index">Function Index</a></li><li><a href="#functions">Function Details</a></li></ul>Keeps track of a number of TCP sessions.
<h2><a name="description">Description</a></h2><p>Keeps track of a number of TCP sessions.</p>
<p>This module will manage a collection of TCP sessions for the same
server. If <code>Port</code> is 0, the underlying OS assigns an available
port number. If a <code>Name</code> is not specified, the server will be
named <code>picoSocketServer_</code> ++ the TCP port number that the service
listens to, e.g. <code>picoSocketServer_9923</code>.</p>
<p>A managed server can be started, stopped, enumerate child sessions,
and limit the maximum number of child sessions.</p>
The conventions used by this module look quite different than
OTP-based services, due to its origin.
<h2><a name="index">Function Index</a></h2>
<table width="100%" border="1" cellspacing="0" cellpadding="2" summary="function index"><tr><td valign="top"><a href="#cold_start-7">cold_start/7</a></td><td></td></tr>
<tr><td valign="top"><a href="#server_children-1">server_children/1</a></td><td></td></tr>
<tr><td valign="top"><a href="#server_children-2">server_children/2</a></td><td></td></tr>
<tr><td valign="top"><a href="#server_port-1">server_port/1</a></td><td></td></tr>
<tr><td valign="top"><a href="#server_port-2">server_port/2</a></td><td></td></tr>
<tr><td valign="top"><a href="#server_status-1">server_status/1</a></td><td></td></tr>
<tr><td valign="top"><a href="#server_status-2">server_status/2</a></td><td></td></tr>
<tr><td valign="top"><a href="#start_child-3">start_child/3</a></td><td></td></tr>
<tr><td valign="top"><a href="#start_raw_server-5">start_raw_server/5</a></td><td></td></tr>
<tr><td valign="top"><a href="#start_raw_server-7">start_raw_server/7</a></td><td></td></tr>
<tr><td valign="top"><a href="#start_server-3">start_server/3</a></td><td>Start a new UBF contract-using server.</td></tr>
<tr><td valign="top"><a href="#start_server-4">start_server/4</a></td><td></td></tr>
<tr><td valign="top"><a href="#stop_server-1">stop_server/1</a></td><td></td></tr>
</table>
<h2><a name="functions">Function Details</a></h2>
<h3 class="function"><a name="cold_start-7">cold_start/7</a></h3>
<div class="spec">
<p><tt>cold_start(Parent, Name, Port, Max, Fun, PacketType, PacketSize) -&gt; any()</tt></p>
</div>
<h3 class="function"><a name="server_children-1">server_children/1</a></h3>
<div class="spec">
<p><tt>server_children(Name) -&gt; any()</tt></p>
</div>
<h3 class="function"><a name="server_children-2">server_children/2</a></h3>
<div class="spec">
<p><tt>server_children(Pid, Timeout) -&gt; any()</tt></p>
</div>
<h3 class="function"><a name="server_port-1">server_port/1</a></h3>
<div class="spec">
<p><tt>server_port(Name) -&gt; any()</tt></p>
</div>
<h3 class="function"><a name="server_port-2">server_port/2</a></h3>
<div class="spec">
<p><tt>server_port(Pid, Timeout) -&gt; any()</tt></p>
</div>
<h3 class="function"><a name="server_status-1">server_status/1</a></h3>
<div class="spec">
<p><tt>server_status(Name) -&gt; any()</tt></p>
</div>
<h3 class="function"><a name="server_status-2">server_status/2</a></h3>
<div class="spec">
<p><tt>server_status(Pid, Timeout) -&gt; any()</tt></p>
</div>
<h3 class="function"><a name="start_child-3">start_child/3</a></h3>
<div class="spec">
<p><tt>start_child(Parent, Listen, Fun) -&gt; any()</tt></p>
</div>
<h3 class="function"><a name="start_raw_server-5">start_raw_server/5</a></h3>
<div class="spec">
<p><tt>start_raw_server(Port, Max, Fun, PacketType, PacketSize) -&gt; any()</tt></p>
</div>
<h3 class="function"><a name="start_raw_server-7">start_raw_server/7</a></h3>
<div class="spec">
<p><tt>start_raw_server(Name, Port, Max, SpawnOpts, Fun, PacketType, PacketSize) -&gt; any()</tt></p>
</div>
<h3 class="function"><a name="start_server-3">start_server/3</a></h3>
<div class="spec">
<p><tt>start_server(Port, Max, Fun) -&gt; any()</tt></p>
</div><p><p>Start a new UBF contract-using server.</p>
<ul>
<li> This server accepts up to Max connections on TCP port Port </li>
<li> SpawnOpts are the erlang garbage collection options for the spawned process.</li>
<li> Each time a new connection is made, Fun(Socket) is called. </li>
</ul>
<p>Fun = fun(Socket) -&gt; exit(normal) | exit(socket_closed) |
exit({socket_error, Reason}) | exit(timeout).
This fun will handle all of the protocol communication for a single
TCP session.</p>
A raw server uses packet length 0 (see start_raw_server/5 and
start_raw_server/7).</p>
<h3 class="function"><a name="start_server-4">start_server/4</a></h3>
<div class="spec">
<p><tt>start_server(Name, Port, Max, Fun) -&gt; any()</tt></p>
</div>
<h3 class="function"><a name="stop_server-1">stop_server/1</a></h3>
<div class="spec">
<p><tt>stop_server(Pid) -&gt; any()</tt></p>
</div>
<hr>
<div class="navbar"><a name="#navbar_bottom"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
<p><i>Generated EDoc, $Id$</i></p>
</body>
</html>