/usr/share/gtk-doc/html/gnet/gnet-server.html is in libgnet-dev 2.0.8-2.2ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Server</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.72.0">
<link rel="start" href="index.html" title="GNet Network Library Reference Manual">
<link rel="up" href="libgnet-reference.html" title="GNet Library Reference">
<link rel="prev" href="gnet-conn.html" title="Conn">
<link rel="next" href="gnet-iochannel.html" title="IOChannel">
<meta name="generator" content="GTK-Doc V1.8 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="chapter" href="gnet-overview.html" title="GNet Overview">
<link rel="chapter" href="gnet-developers.html" title="GNet for developers">
<link rel="chapter" href="gnet-examples.html" title="GNet Examples">
<link rel="chapter" href="libgnet-reference.html" title="GNet Library Reference">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="gnet-conn.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="libgnet-reference.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GNet Network Library Reference Manual</th>
<td><a accesskey="n" href="gnet-iochannel.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts"><nobr><a href="#id377071" class="shortcut">Top</a>
 | 
<a href="#id377579" class="shortcut">Description</a></nobr></td></tr>
</table>
<div class="refentry" lang="en">
<a name="gnet-server"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2>
<a name="id377071"></a><span class="refentrytitle">Server</span>
</h2>
<p>Server — TCP server object</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<pre class="synopsis">
#include <gnet.h>
<a href="gnet-server.html#GServer">GServer</a>;
void (<a href="gnet-server.html#GServerFunc">*GServerFunc</a>) (<a href="gnet-server.html#GServer">GServer</a> *server,
<a href="gnet-conn.html#GConn">GConn</a> *conn,
gpointer user_data);
<a href="gnet-server.html#GServer">GServer</a>* <a href="gnet-server.html#gnet-server-new">gnet_server_new</a> (const <a href="gnet-inetaddr.html#GInetAddr">GInetAddr</a> *iface,
gint port,
<a href="gnet-server.html#GServerFunc">GServerFunc</a> func,
gpointer user_data);
void <a href="gnet-server.html#gnet-server-delete">gnet_server_delete</a> (<a href="gnet-server.html#GServer">GServer</a> *server);
void <a href="gnet-server.html#gnet-server-ref">gnet_server_ref</a> (<a href="gnet-server.html#GServer">GServer</a> *server);
void <a href="gnet-server.html#gnet-server-unref">gnet_server_unref</a> (<a href="gnet-server.html#GServer">GServer</a> *server);
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id377579"></a><h2>Description</h2>
<p>
A <a href="gnet-server.html#GServer"><span class="type">GServer</span></a> represents a TCP server. <a href="gnet-server.html#GServer"><span class="type">GServer</span></a> is a thin wrapper around a
TCP server socket. To create a new <a href="gnet-server.html#GServer"><span class="type">GServer</span></a>, call <a href="gnet-server.html#gnet-server-new"><code class="function">gnet_server_new()</code></a>.
One of the arguments is a callback function that is called with a new
<a href="gnet-conn.html#GConn"><span class="type">GConn</span></a> whenever a new client connects. Remember to call
<a href="gnet-conn.html#gnet-conn-set-callback"><code class="function">gnet_conn_set_callback()</code></a> on the new <a href="gnet-conn.html#GConn"><span class="type">GConn</span></a> to set the <a href="gnet-conn.html#GConn"><span class="type">GConn</span></a> callback.
To delete a <a href="gnet-server.html#GServer"><span class="type">GServer</span></a>, call <a href="gnet-server.html#gnet-server-delete"><code class="function">gnet_server_delete()</code></a>.
</p>
<p>
See also <a href="gnet-conn.html#GConn"><span class="type">GConn</span></a> and the echoserver-gserver example.
</p>
</div>
<div class="refsect1" lang="en">
<a name="id377693"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="id377703"></a><h3>
<a name="GServer"></a>GServer</h3>
<a class="indexterm" name="id377716"></a><pre class="programlisting">typedef struct {
GInetAddr* iface;
gint port;
GTcpSocket* socket;
guint ref_count;
GServerFunc func;
gpointer user_data;
} GServer;
</pre>
<p>
<a href="gnet-server.html#GServer"><span class="type">GServer</span></a> is a high-level interface to a TCP server socket. The
callback is called with a <a href="gnet-conn.html#GConn"><span class="type">GConn</span></a> whenever a new connection is
made.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><a href="gnet-inetaddr.html#GInetAddr">GInetAddr</a> *<em class="structfield"><code>iface</code></em>;</span></td>
<td> interface address
</td>
</tr>
<tr>
<td><span class="term">gint <em class="structfield"><code>port</code></em>;</span></td>
<td> port number
</td>
</tr>
<tr>
<td><span class="term"><a href="gnet-tcp.html#GTcpSocket">GTcpSocket</a> *<em class="structfield"><code>socket</code></em>;</span></td>
<td> TCP server socket
</td>
</tr>
<tr>
<td><span class="term">guint <em class="structfield"><code>ref_count</code></em>;</span></td>
<td> [private]
</td>
</tr>
<tr>
<td><span class="term"><a href="gnet-server.html#GServerFunc">GServerFunc</a> <em class="structfield"><code>func</code></em>;</span></td>
<td> callback function
</td>
</tr>
<tr>
<td><span class="term">gpointer <em class="structfield"><code>user_data</code></em>;</span></td>
<td> user data for callback
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id377877"></a><h3>
<a name="GServerFunc"></a>GServerFunc ()</h3>
<a class="indexterm" name="id377889"></a><pre class="programlisting">void (*GServerFunc) (<a href="gnet-server.html#GServer">GServer</a> *server,
<a href="gnet-conn.html#GConn">GConn</a> *conn,
gpointer user_data);</pre>
<p>
Callback for <a href="gnet-server.html#gnet-server-new"><code class="function">gnet_server_new()</code></a>. When a client connects, this
callback is called with a new connection. If the server fails,
this callback is called with <em class="parameter"><code>conn</code></em> set to NULL. The callback is
not called again.
</p>
<p>
If <em class="parameter"><code>conn</code></em> is non-NULL, the address (IP, port) of the client that
established the connection can be found in the inetaddr member of
the <a href="gnet-conn.html#GConn"><span class="type">GConn</span></a> structure.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>server</code></em> :</span></td>
<td> server
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>conn</code></em> :</span></td>
<td> new connection (or NULL if error)
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>user_data</code></em> :</span></td>
<td> user data specified in <a href="gnet-server.html#gnet-server-new"><code class="function">gnet_server_new()</code></a>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id378027"></a><h3>
<a name="gnet-server-new"></a>gnet_server_new ()</h3>
<a class="indexterm" name="id378039"></a><pre class="programlisting"><a href="gnet-server.html#GServer">GServer</a>* gnet_server_new (const <a href="gnet-inetaddr.html#GInetAddr">GInetAddr</a> *iface,
gint port,
<a href="gnet-server.html#GServerFunc">GServerFunc</a> func,
gpointer user_data);</pre>
<p>
Creates a new <a href="gnet-server.html#GServer"><span class="type">GServer</span></a> object representing a server. Usually,
<em class="parameter"><code>iface</code></em> is set to NULL to bind to all interfaces and <em class="parameter"><code>port</code></em> is a
specific number. The callback is called whenever a new connection
arrives or if there is a server error. The callback is not called
again after a server error.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>iface</code></em> :</span></td>
<td> interface to bind to (NULL for all interfaces)
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>port</code></em> :</span></td>
<td> port to bind to (0 for an arbitrary port)
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>func</code></em> :</span></td>
<td> callback to call when a connection is accepted
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>user_data</code></em> :</span></td>
<td> data to pass to callback
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> a new <a href="gnet-server.html#GServer"><span class="type">GServer</span></a>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id378192"></a><h3>
<a name="gnet-server-delete"></a>gnet_server_delete ()</h3>
<a class="indexterm" name="id378204"></a><pre class="programlisting">void gnet_server_delete (<a href="gnet-server.html#GServer">GServer</a> *server);</pre>
<p>
Closes and deletes a <a href="gnet-server.html#GServer"><span class="type">GServer</span></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><span class="term"><em class="parameter"><code>server</code></em> :</span></td>
<td> <a href="gnet-server.html#GServer"><span class="type">GServer</span></a> to delete.
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id378269"></a><h3>
<a name="gnet-server-ref"></a>gnet_server_ref ()</h3>
<a class="indexterm" name="id378282"></a><pre class="programlisting">void gnet_server_ref (<a href="gnet-server.html#GServer">GServer</a> *server);</pre>
<p>
Adds a reference to a <a href="gnet-server.html#GServer"><span class="type">GServer</span></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><span class="term"><em class="parameter"><code>server</code></em> :</span></td>
<td> a <a href="gnet-server.html#GServer"><span class="type">GServer</span></a>
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id378346"></a><h3>
<a name="gnet-server-unref"></a>gnet_server_unref ()</h3>
<a class="indexterm" name="id378358"></a><pre class="programlisting">void gnet_server_unref (<a href="gnet-server.html#GServer">GServer</a> *server);</pre>
<p>
Removes a reference from a <a href="gnet-server.html#GServer"><span class="type">GServer</span></a>. A <a href="gnet-server.html#GServer"><span class="type">GServer</span></a> is deleted when
the reference count reaches 0.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><span class="term"><em class="parameter"><code>server</code></em> :</span></td>
<td> a <a href="gnet-server.html#GServer"><span class="type">GServer</span></a>
</td>
</tr></tbody>
</table></div>
</div>
</div>
</div>
</body>
</html>
|