/usr/share/gtk-doc/html/gnet/gnet-unix.html is in libgnet-dev 2.0.8-2.1.
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 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Unix</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-sha.html" title="SHA">
<link rel="next" href="gnet-ipv6.html" title="IPv6">
<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-sha.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-ipv6.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="#id397998" class="shortcut">Top</a>
 | 
<a href="#id398605" class="shortcut">Description</a></nobr></td></tr>
</table>
<div class="refentry" lang="en">
<a name="gnet-unix"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2>
<a name="id397998"></a><span class="refentrytitle">Unix</span>
</h2>
<p>Unix — Unix socket</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-unix.html#GUnixSocket">GUnixSocket</a>;
<a href="gnet-unix.html#GUnixSocket">GUnixSocket</a>* <a href="gnet-unix.html#gnet-unix-socket-new">gnet_unix_socket_new</a> (const gchar *path);
<a href="gnet-unix.html#GUnixSocket">GUnixSocket</a>* <a href="gnet-unix.html#gnet-unix-socket-new-abstract">gnet_unix_socket_new_abstract</a> (const gchar *path);
void <a href="gnet-unix.html#gnet-unix-socket-delete">gnet_unix_socket_delete</a> (<a href="gnet-unix.html#GUnixSocket">GUnixSocket</a> *socket);
void <a href="gnet-unix.html#gnet-unix-socket-ref">gnet_unix_socket_ref</a> (<a href="gnet-unix.html#GUnixSocket">GUnixSocket</a> *socket);
void <a href="gnet-unix.html#gnet-unix-socket-unref">gnet_unix_socket_unref</a> (<a href="gnet-unix.html#GUnixSocket">GUnixSocket</a> *socket);
GIOChannel* <a href="gnet-unix.html#gnet-unix-socket-get-io-channel">gnet_unix_socket_get_io_channel</a> (<a href="gnet-unix.html#GUnixSocket">GUnixSocket</a> *socket);
gchar* <a href="gnet-unix.html#gnet-unix-socket-get-path">gnet_unix_socket_get_path</a> (const <a href="gnet-unix.html#GUnixSocket">GUnixSocket</a> *socket);
<a href="gnet-unix.html#GUnixSocket">GUnixSocket</a>* <a href="gnet-unix.html#gnet-unix-socket-server-new">gnet_unix_socket_server_new</a> (const gchar *path);
<a href="gnet-unix.html#GUnixSocket">GUnixSocket</a>* <a href="gnet-unix.html#gnet-unix-socket-server-new-abstract">gnet_unix_socket_server_new_abstract</a>
(const gchar *path);
<a href="gnet-unix.html#GUnixSocket">GUnixSocket</a>* <a href="gnet-unix.html#gnet-unix-socket-server-accept">gnet_unix_socket_server_accept</a> (const <a href="gnet-unix.html#GUnixSocket">GUnixSocket</a> *socket);
<a href="gnet-unix.html#GUnixSocket">GUnixSocket</a>* <a href="gnet-unix.html#gnet-unix-socket-server-accept-nonblock">gnet_unix_socket_server_accept_nonblock</a>
(const <a href="gnet-unix.html#GUnixSocket">GUnixSocket</a> *socket);
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id398605"></a><h2>Description</h2>
<p>
The Unix module provides support for Unix sockets. Unix sockets are
used to communicate between processes. Unix sockets are for Unix
operating systems only and are not supported in Windows. GNet's Unix
sockets are stream-based (like TCP), not datagram-based (like UDP).
Unix socket addresses are file names, like "/tmp/my_unix_socket".
</p>
<p>
To connect to a existing Unix socket, call <a href="gnet-unix.html#gnet-unix-socket-new"><code class="function">gnet_unix_socket_new()</code></a>. To
create a new Unix socket other processes will connect to, call
<a href="gnet-unix.html#gnet-unix-socket-server-new"><code class="function">gnet_unix_socket_server_new()</code></a>.
</p>
<p>
The functions in this module are similar to those in the TCP module.
See the documentation on TCP sockets for more information.
</p>
</div>
<div class="refsect1" lang="en">
<a name="id398651"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="id398661"></a><h3>
<a name="GUnixSocket"></a>GUnixSocket</h3>
<a class="indexterm" name="id398673"></a><pre class="programlisting">typedef struct _GUnixSocket GUnixSocket;</pre>
<p>
A <a href="gnet-unix.html#GUnixSocket"><span class="type">GUnixSocket</span></a> structure represents a Unix socket. The
implementation is hidden.</p>
<p>
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id398700"></a><h3>
<a name="gnet-unix-socket-new"></a>gnet_unix_socket_new ()</h3>
<a class="indexterm" name="id398712"></a><pre class="programlisting"><a href="gnet-unix.html#GUnixSocket">GUnixSocket</a>* gnet_unix_socket_new (const gchar *path);</pre>
<p>
Creates a <a href="gnet-unix.html#GUnixSocket"><span class="type">GUnixSocket</span></a> and connects to <em class="parameter"><code>path</code></em>. This function will
block to connect. Use this constructor to create a <a href="gnet-unix.html#GUnixSocket"><span class="type">GUnixSocket</span></a>
for a client.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>path</code></em> :</span></td>
<td> path
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> a new <a href="gnet-unix.html#GUnixSocket"><span class="type">GUnixSocket</span></a>; NULL on failure.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id398802"></a><h3>
<a name="gnet-unix-socket-new-abstract"></a>gnet_unix_socket_new_abstract ()</h3>
<a class="indexterm" name="id398817"></a><pre class="programlisting"><a href="gnet-unix.html#GUnixSocket">GUnixSocket</a>* gnet_unix_socket_new_abstract (const gchar *path);</pre>
<p>
Creates a <a href="gnet-unix.html#GUnixSocket"><span class="type">GUnixSocket</span></a> and connects to <em class="parameter"><code>path</code></em> in the abstract
unix socket domain. This function will block to connect. Use this
constructor to create a <a href="gnet-unix.html#GUnixSocket"><span class="type">GUnixSocket</span></a> for a client.
</p>
<p>
If the abstract unix sockets are not available on the platform in use,
this function will behave like <a href="gnet-unix.html#gnet-unix-socket-new"><code class="function">gnet_unix_socket_new()</code></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>path</code></em> :</span></td>
<td> path
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> a new <a href="gnet-unix.html#GUnixSocket"><span class="type">GUnixSocket</span></a>, or NULL on failure.
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.0.8
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id398929"></a><h3>
<a name="gnet-unix-socket-delete"></a>gnet_unix_socket_delete ()</h3>
<a class="indexterm" name="id398941"></a><pre class="programlisting">void gnet_unix_socket_delete (<a href="gnet-unix.html#GUnixSocket">GUnixSocket</a> *socket);</pre>
<p>
Deletes a <a href="gnet-unix.html#GUnixSocket"><span class="type">GUnixSocket</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>socket</code></em> :</span></td>
<td> a <a href="gnet-unix.html#GUnixSocket"><span class="type">GUnixSocket</span></a>
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id399005"></a><h3>
<a name="gnet-unix-socket-ref"></a>gnet_unix_socket_ref ()</h3>
<a class="indexterm" name="id399018"></a><pre class="programlisting">void gnet_unix_socket_ref (<a href="gnet-unix.html#GUnixSocket">GUnixSocket</a> *socket);</pre>
<p>
Adds a reference to a <a href="gnet-unix.html#GUnixSocket"><span class="type">GUnixSocket</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>socket</code></em> :</span></td>
<td> a <a href="gnet-unix.html#GUnixSocket"><span class="type">GUnixSocket</span></a>
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id399082"></a><h3>
<a name="gnet-unix-socket-unref"></a>gnet_unix_socket_unref ()</h3>
<a class="indexterm" name="id399094"></a><pre class="programlisting">void gnet_unix_socket_unref (<a href="gnet-unix.html#GUnixSocket">GUnixSocket</a> *socket);</pre>
<p>
Removes a reference from a <a href="gnet-unix.html#GUnixSocket"><span class="type">GUnixSocket</span></a>. A <a href="gnet-unix.html#GUnixSocket"><span class="type">GUnixSocket</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>socket</code></em> :</span></td>
<td> a <a href="gnet-unix.html#GUnixSocket"><span class="type">GUnixSocket</span></a>
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id399167"></a><h3>
<a name="gnet-unix-socket-get-io-channel"></a>gnet_unix_socket_get_io_channel ()</h3>
<a class="indexterm" name="id399180"></a><pre class="programlisting">GIOChannel* gnet_unix_socket_get_io_channel (<a href="gnet-unix.html#GUnixSocket">GUnixSocket</a> *socket);</pre>
<p>
Gets the <span class="type">GIOChannel</span> of a <a href="gnet-unix.html#GUnixSocket"><span class="type">GUnixSocket</span></a>.
</p>
<p>
For a client socket, the <span class="type">GIOChannel</span> represents the data stream.
Use it like you would any other <span class="type">GIOChannel</span>.
</p>
<p>
For a server socket, however, the <span class="type">GIOChannel</span> represents the
listening socket. When it's readable, there's a connection
waiting to be accepted.
</p>
<p>
Every <a href="gnet-unix.html#GUnixSocket"><span class="type">GUnixSocket</span></a> has one and only one <span class="type">GIOChannel</span>. If you ref
the channel, then you must unref it eventually. Do not close the
channel. The channel is closed by GNet when the socket is
deleted.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>socket</code></em> :</span></td>
<td> a <a href="gnet-unix.html#GUnixSocket"><span class="type">GUnixSocket</span></a>
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> a <span class="type">GIOChannel</span>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id399323"></a><h3>
<a name="gnet-unix-socket-get-path"></a>gnet_unix_socket_get_path ()</h3>
<a class="indexterm" name="id399336"></a><pre class="programlisting">gchar* gnet_unix_socket_get_path (const <a href="gnet-unix.html#GUnixSocket">GUnixSocket</a> *socket);</pre>
<p>
Gets the path of a <a href="gnet-unix.html#GUnixSocket"><span class="type">GUnixSocket</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>socket</code></em> :</span></td>
<td> a <a href="gnet-unix.html#GUnixSocket"><span class="type">GUnixSocket</span></a>
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the path.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id399410"></a><h3>
<a name="gnet-unix-socket-server-new"></a>gnet_unix_socket_server_new ()</h3>
<a class="indexterm" name="id399423"></a><pre class="programlisting"><a href="gnet-unix.html#GUnixSocket">GUnixSocket</a>* gnet_unix_socket_server_new (const gchar *path);</pre>
<p>
Creates a <a href="gnet-unix.html#GUnixSocket"><span class="type">GUnixSocket</span></a> bound to <em class="parameter"><code>path</code></em>. Use this constructor to
create a <a href="gnet-unix.html#GUnixSocket"><span class="type">GUnixSocket</span></a> for a server.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>path</code></em> :</span></td>
<td> path
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> a new <a href="gnet-unix.html#GUnixSocket"><span class="type">GUnixSocket</span></a>; NULL on error.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id399513"></a><h3>
<a name="gnet-unix-socket-server-new-abstract"></a>gnet_unix_socket_server_new_abstract ()</h3>
<a class="indexterm" name="id399528"></a><pre class="programlisting"><a href="gnet-unix.html#GUnixSocket">GUnixSocket</a>* gnet_unix_socket_server_new_abstract
(const gchar *path);</pre>
<p>
Creates a <a href="gnet-unix.html#GUnixSocket"><span class="type">GUnixSocket</span></a> bound to <em class="parameter"><code>path</code></em> in the abstract unix socket
domain. Use this constructor to create a <a href="gnet-unix.html#GUnixSocket"><span class="type">GUnixSocket</span></a> for a
server.
</p>
<p>
If the abstract unix sockets are not available on the platform in use,
this function will behave the same as <a href="gnet-unix.html#gnet-unix-socket-server-new"><code class="function">gnet_unix_socket_server_new()</code></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>path</code></em> :</span></td>
<td> path
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> a new <a href="gnet-unix.html#GUnixSocket"><span class="type">GUnixSocket</span></a>, or NULL on error.
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.0.8
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id399640"></a><h3>
<a name="gnet-unix-socket-server-accept"></a>gnet_unix_socket_server_accept ()</h3>
<a class="indexterm" name="id399653"></a><pre class="programlisting"><a href="gnet-unix.html#GUnixSocket">GUnixSocket</a>* gnet_unix_socket_server_accept (const <a href="gnet-unix.html#GUnixSocket">GUnixSocket</a> *socket);</pre>
<p>
Accepts a connection from a <a href="gnet-unix.html#GUnixSocket"><span class="type">GUnixSocket</span></a>. The socket must have
been created using <a href="gnet-unix.html#gnet-unix-socket-server-new"><code class="function">gnet_unix_socket_server_new()</code></a>. This function
will block. Even if the socket's <span class="type">GIOChannel</span> is readable, the
function may still block.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>socket</code></em> :</span></td>
<td> a <a href="gnet-unix.html#GUnixSocket"><span class="type">GUnixSocket</span></a>
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> a new <a href="gnet-unix.html#GUnixSocket"><span class="type">GUnixSocket</span></a> representing a new connection; NULL on
error.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id399756"></a><h3>
<a name="gnet-unix-socket-server-accept-nonblock"></a>gnet_unix_socket_server_accept_nonblock ()</h3>
<a class="indexterm" name="id399769"></a><pre class="programlisting"><a href="gnet-unix.html#GUnixSocket">GUnixSocket</a>* gnet_unix_socket_server_accept_nonblock
(const <a href="gnet-unix.html#GUnixSocket">GUnixSocket</a> *socket);</pre>
<p>
Accepts a connection from a <a href="gnet-unix.html#GUnixSocket"><span class="type">GUnixSocket</span></a> without blocking. The
socket must have been created using <a href="gnet-unix.html#gnet-unix-socket-server-new"><code class="function">gnet_unix_socket_server_new()</code></a>.
</p>
<p>
Note that if the socket's <span class="type">GIOChannel</span> is readable, then there is
PROBABLY a new connection. It is possible for the connection
to close by the time this function is called, so it may return
NULL.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>socket</code></em> :</span></td>
<td> a <a href="gnet-unix.html#GUnixSocket"><span class="type">GUnixSocket</span></a>
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> a new <a href="gnet-unix.html#GUnixSocket"><span class="type">GUnixSocket</span></a> representing a new connection; NULL
otherwise.
</td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
</body>
</html>
|