Imported Upstream version 2.50.2
[platform/upstream/glib.git] / docs / reference / gio / html / GSocketListener.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <title>GSocketListener: GIO Reference Manual</title>
6 <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7 <link rel="home" href="index.html" title="GIO Reference Manual">
8 <link rel="up" href="highlevel-socket.html" title="High-level network functionallity">
9 <link rel="prev" href="GTcpWrapperConnection.html" title="GTcpWrapperConnection">
10 <link rel="next" href="GSocketService.html" title="GSocketService">
11 <meta name="generator" content="GTK-Doc V1.25.1 (XML mode)">
12 <link rel="stylesheet" href="style.css" type="text/css">
13 </head>
14 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
15 <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
16 <td width="100%" align="left" class="shortcuts">
17 <a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
18                   <a href="#GSocketListener.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
19                   <a href="#GSocketListener.object-hierarchy" class="shortcut">Object Hierarchy</a></span><span id="nav_properties">  <span class="dim">|</span> 
20                   <a href="#GSocketListener.properties" class="shortcut">Properties</a></span><span id="nav_signals">  <span class="dim">|</span> 
21                   <a href="#GSocketListener.signals" class="shortcut">Signals</a></span>
22 </td>
23 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
24 <td><a accesskey="u" href="highlevel-socket.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
25 <td><a accesskey="p" href="GTcpWrapperConnection.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
26 <td><a accesskey="n" href="GSocketService.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
27 </tr></table>
28 <div class="refentry">
29 <a name="GSocketListener"></a><div class="titlepage"></div>
30 <div class="refnamediv"><table width="100%"><tr>
31 <td valign="top">
32 <h2><span class="refentrytitle"><a name="GSocketListener.top_of_page"></a>GSocketListener</span></h2>
33 <p>GSocketListener — Helper for accepting network client connections</p>
34 </td>
35 <td class="gallery_image" valign="top" align="right"></td>
36 </tr></table></div>
37 <div class="refsect1">
38 <a name="GSocketListener.functions"></a><h2>Functions</h2>
39 <div class="informaltable"><table class="informaltable" width="100%" border="0">
40 <colgroup>
41 <col width="150px" class="functions_return">
42 <col class="functions_name">
43 </colgroup>
44 <tbody>
45 <tr>
46 <td class="function_type">
47 <a class="link" href="GSocketListener.html" title="GSocketListener"><span class="returnvalue">GSocketListener</span></a> *
48 </td>
49 <td class="function_name">
50 <a class="link" href="GSocketListener.html#g-socket-listener-new" title="g_socket_listener_new ()">g_socket_listener_new</a> <span class="c_punctuation">()</span>
51 </td>
52 </tr>
53 <tr>
54 <td class="function_type">
55 <a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
56 </td>
57 <td class="function_name">
58 <a class="link" href="GSocketListener.html#g-socket-listener-add-socket" title="g_socket_listener_add_socket ()">g_socket_listener_add_socket</a> <span class="c_punctuation">()</span>
59 </td>
60 </tr>
61 <tr>
62 <td class="function_type">
63 <a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
64 </td>
65 <td class="function_name">
66 <a class="link" href="GSocketListener.html#g-socket-listener-add-address" title="g_socket_listener_add_address ()">g_socket_listener_add_address</a> <span class="c_punctuation">()</span>
67 </td>
68 </tr>
69 <tr>
70 <td class="function_type">
71 <a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
72 </td>
73 <td class="function_name">
74 <a class="link" href="GSocketListener.html#g-socket-listener-add-inet-port" title="g_socket_listener_add_inet_port ()">g_socket_listener_add_inet_port</a> <span class="c_punctuation">()</span>
75 </td>
76 </tr>
77 <tr>
78 <td class="function_type">
79 <a href="../glib-Basic-Types.html#guint16"><span class="returnvalue">guint16</span></a>
80 </td>
81 <td class="function_name">
82 <a class="link" href="GSocketListener.html#g-socket-listener-add-any-inet-port" title="g_socket_listener_add_any_inet_port ()">g_socket_listener_add_any_inet_port</a> <span class="c_punctuation">()</span>
83 </td>
84 </tr>
85 <tr>
86 <td class="function_type">
87 <a class="link" href="GSocketConnection.html" title="GSocketConnection"><span class="returnvalue">GSocketConnection</span></a> *
88 </td>
89 <td class="function_name">
90 <a class="link" href="GSocketListener.html#g-socket-listener-accept" title="g_socket_listener_accept ()">g_socket_listener_accept</a> <span class="c_punctuation">()</span>
91 </td>
92 </tr>
93 <tr>
94 <td class="function_type">
95 <span class="returnvalue">void</span>
96 </td>
97 <td class="function_name">
98 <a class="link" href="GSocketListener.html#g-socket-listener-accept-async" title="g_socket_listener_accept_async ()">g_socket_listener_accept_async</a> <span class="c_punctuation">()</span>
99 </td>
100 </tr>
101 <tr>
102 <td class="function_type">
103 <a class="link" href="GSocketConnection.html" title="GSocketConnection"><span class="returnvalue">GSocketConnection</span></a> *
104 </td>
105 <td class="function_name">
106 <a class="link" href="GSocketListener.html#g-socket-listener-accept-finish" title="g_socket_listener_accept_finish ()">g_socket_listener_accept_finish</a> <span class="c_punctuation">()</span>
107 </td>
108 </tr>
109 <tr>
110 <td class="function_type">
111 <a class="link" href="GSocket.html" title="GSocket"><span class="returnvalue">GSocket</span></a> *
112 </td>
113 <td class="function_name">
114 <a class="link" href="GSocketListener.html#g-socket-listener-accept-socket" title="g_socket_listener_accept_socket ()">g_socket_listener_accept_socket</a> <span class="c_punctuation">()</span>
115 </td>
116 </tr>
117 <tr>
118 <td class="function_type">
119 <span class="returnvalue">void</span>
120 </td>
121 <td class="function_name">
122 <a class="link" href="GSocketListener.html#g-socket-listener-accept-socket-async" title="g_socket_listener_accept_socket_async ()">g_socket_listener_accept_socket_async</a> <span class="c_punctuation">()</span>
123 </td>
124 </tr>
125 <tr>
126 <td class="function_type">
127 <a class="link" href="GSocket.html" title="GSocket"><span class="returnvalue">GSocket</span></a> *
128 </td>
129 <td class="function_name">
130 <a class="link" href="GSocketListener.html#g-socket-listener-accept-socket-finish" title="g_socket_listener_accept_socket_finish ()">g_socket_listener_accept_socket_finish</a> <span class="c_punctuation">()</span>
131 </td>
132 </tr>
133 <tr>
134 <td class="function_type">
135 <span class="returnvalue">void</span>
136 </td>
137 <td class="function_name">
138 <a class="link" href="GSocketListener.html#g-socket-listener-close" title="g_socket_listener_close ()">g_socket_listener_close</a> <span class="c_punctuation">()</span>
139 </td>
140 </tr>
141 <tr>
142 <td class="function_type">
143 <span class="returnvalue">void</span>
144 </td>
145 <td class="function_name">
146 <a class="link" href="GSocketListener.html#g-socket-listener-set-backlog" title="g_socket_listener_set_backlog ()">g_socket_listener_set_backlog</a> <span class="c_punctuation">()</span>
147 </td>
148 </tr>
149 </tbody>
150 </table></div>
151 </div>
152 <div class="refsect1">
153 <a name="GSocketListener.properties"></a><h2>Properties</h2>
154 <div class="informaltable"><table class="informaltable" border="0">
155 <colgroup>
156 <col width="150px" class="properties_type">
157 <col width="300px" class="properties_name">
158 <col width="200px" class="properties_flags">
159 </colgroup>
160 <tbody><tr>
161 <td class="property_type"><a href="../glib-Basic-Types.html#gint"><span class="type">gint</span></a></td>
162 <td class="property_name"><a class="link" href="GSocketListener.html#GSocketListener--listen-backlog" title="The “listen-backlog” property">listen-backlog</a></td>
163 <td class="property_flags">Read / Write / Construct</td>
164 </tr></tbody>
165 </table></div>
166 </div>
167 <div class="refsect1">
168 <a name="GSocketListener.signals"></a><h2>Signals</h2>
169 <div class="informaltable"><table class="informaltable" border="0">
170 <colgroup>
171 <col width="150px" class="signals_return">
172 <col width="300px" class="signals_name">
173 <col width="200px" class="signals_flags">
174 </colgroup>
175 <tbody><tr>
176 <td class="signal_type"><span class="returnvalue">void</span></td>
177 <td class="signal_name"><a class="link" href="GSocketListener.html#GSocketListener-event" title="The “event” signal">event</a></td>
178 <td class="signal_flags"><a href="../gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS">Run Last</a></td>
179 </tr></tbody>
180 </table></div>
181 </div>
182 <div class="refsect1">
183 <a name="GSocketListener.other"></a><h2>Types and Values</h2>
184 <div class="informaltable"><table class="informaltable" width="100%" border="0">
185 <colgroup>
186 <col width="150px" class="name">
187 <col class="description">
188 </colgroup>
189 <tbody>
190 <tr>
191 <td class="datatype_keyword"> </td>
192 <td class="function_name"><a class="link" href="GSocketListener.html#GSocketListener-struct" title="GSocketListener">GSocketListener</a></td>
193 </tr>
194 <tr>
195 <td class="datatype_keyword">enum</td>
196 <td class="function_name"><a class="link" href="GSocketListener.html#GSocketListenerEvent" title="enum GSocketListenerEvent">GSocketListenerEvent</a></td>
197 </tr>
198 </tbody>
199 </table></div>
200 </div>
201 <div class="refsect1">
202 <a name="GSocketListener.object-hierarchy"></a><h2>Object Hierarchy</h2>
203 <pre class="screen">    <a href="../gobject-The-Base-Object-Type.html#GObject-struct">GObject</a>
204     <span class="lineart">╰──</span> GSocketListener
205         <span class="lineart">╰──</span> <a class="link" href="GSocketService.html" title="GSocketService">GSocketService</a>
206 </pre>
207 </div>
208 <div class="refsect1">
209 <a name="GSocketListener.includes"></a><h2>Includes</h2>
210 <pre class="synopsis">#include &lt;gio/gio.h&gt;
211 </pre>
212 </div>
213 <div class="refsect1">
214 <a name="GSocketListener.description"></a><h2>Description</h2>
215 <p>A <a class="link" href="GSocketListener.html" title="GSocketListener"><span class="type">GSocketListener</span></a> is an object that keeps track of a set
216 of server sockets and helps you accept sockets from any of the
217 socket, either sync or async.</p>
218 <p>If you want to implement a network server, also look at <a class="link" href="GSocketService.html" title="GSocketService"><span class="type">GSocketService</span></a>
219 and <a class="link" href="GThreadedSocketService.html" title="GThreadedSocketService"><span class="type">GThreadedSocketService</span></a> which are subclass of <a class="link" href="GSocketListener.html" title="GSocketListener"><span class="type">GSocketListener</span></a>
220 that makes this even easier.</p>
221 </div>
222 <div class="refsect1">
223 <a name="GSocketListener.functions_details"></a><h2>Functions</h2>
224 <div class="refsect2">
225 <a name="g-socket-listener-new"></a><h3>g_socket_listener_new ()</h3>
226 <pre class="programlisting"><a class="link" href="GSocketListener.html" title="GSocketListener"><span class="returnvalue">GSocketListener</span></a> *
227 g_socket_listener_new (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
228 <p>Creates a new <a class="link" href="GSocketListener.html" title="GSocketListener"><span class="type">GSocketListener</span></a> with no sockets to listen for.
229 New listeners can be added with e.g. <a class="link" href="GSocketListener.html#g-socket-listener-add-address" title="g_socket_listener_add_address ()"><code class="function">g_socket_listener_add_address()</code></a>
230 or <a class="link" href="GSocketListener.html#g-socket-listener-add-inet-port" title="g_socket_listener_add_inet_port ()"><code class="function">g_socket_listener_add_inet_port()</code></a>.</p>
231 <div class="refsect3">
232 <a name="g-socket-listener-new.returns"></a><h4>Returns</h4>
233 <p> a new <a class="link" href="GSocketListener.html" title="GSocketListener"><span class="type">GSocketListener</span></a>.</p>
234 </div>
235 <p class="since">Since: <a class="link" href="api-index-2-22.html#api-index-2.22">2.22</a></p>
236 </div>
237 <hr>
238 <div class="refsect2">
239 <a name="g-socket-listener-add-socket"></a><h3>g_socket_listener_add_socket ()</h3>
240 <pre class="programlisting"><a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
241 g_socket_listener_add_socket (<em class="parameter"><code><a class="link" href="GSocketListener.html" title="GSocketListener"><span class="type">GSocketListener</span></a> *listener</code></em>,
242                               <em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
243                               <em class="parameter"><code><a href="../gobject-The-Base-Object-Type.html#GObject-struct"><span class="type">GObject</span></a> *source_object</code></em>,
244                               <em class="parameter"><code><a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
245 <p>Adds <em class="parameter"><code>socket</code></em>
246  to the set of sockets that we try to accept
247 new clients from. The socket must be bound to a local
248 address and listened to.</p>
249 <p><em class="parameter"><code>source_object</code></em>
250  will be passed out in the various calls
251 to accept to identify this particular source, which is
252 useful if you're listening on multiple addresses and do
253 different things depending on what address is connected to.</p>
254 <p>The <em class="parameter"><code>socket</code></em>
255  will not be automatically closed when the <em class="parameter"><code>listener</code></em>
256  is finalized
257 unless the listener held the final reference to the socket. Before GLib 2.42,
258 the <em class="parameter"><code>socket</code></em>
259  was automatically closed on finalization of the <em class="parameter"><code>listener</code></em>
260 , even
261 if references to it were held elsewhere.</p>
262 <div class="refsect3">
263 <a name="g-socket-listener-add-socket.parameters"></a><h4>Parameters</h4>
264 <div class="informaltable"><table class="informaltable" width="100%" border="0">
265 <colgroup>
266 <col width="150px" class="parameters_name">
267 <col class="parameters_description">
268 <col width="200px" class="parameters_annotations">
269 </colgroup>
270 <tbody>
271 <tr>
272 <td class="parameter_name"><p>listener</p></td>
273 <td class="parameter_description"><p>a <a class="link" href="GSocketListener.html" title="GSocketListener"><span class="type">GSocketListener</span></a></p></td>
274 <td class="parameter_annotations"> </td>
275 </tr>
276 <tr>
277 <td class="parameter_name"><p>socket</p></td>
278 <td class="parameter_description"><p>a listening <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a></p></td>
279 <td class="parameter_annotations"> </td>
280 </tr>
281 <tr>
282 <td class="parameter_name"><p>source_object</p></td>
283 <td class="parameter_description"><p> Optional <a href="../gobject-The-Base-Object-Type.html#GObject-struct"><span class="type">GObject</span></a> identifying this source. </p></td>
284 <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
285 </tr>
286 <tr>
287 <td class="parameter_name"><p>error</p></td>
288 <td class="parameter_description"><p><a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a> for error reporting, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore.</p></td>
289 <td class="parameter_annotations"> </td>
290 </tr>
291 </tbody>
292 </table></div>
293 </div>
294 <div class="refsect3">
295 <a name="g-socket-listener-add-socket.returns"></a><h4>Returns</h4>
296 <p> <a href="../glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> on success, <a href="../glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> on error.</p>
297 </div>
298 <p class="since">Since: <a class="link" href="api-index-2-22.html#api-index-2.22">2.22</a></p>
299 </div>
300 <hr>
301 <div class="refsect2">
302 <a name="g-socket-listener-add-address"></a><h3>g_socket_listener_add_address ()</h3>
303 <pre class="programlisting"><a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
304 g_socket_listener_add_address (<em class="parameter"><code><a class="link" href="GSocketListener.html" title="GSocketListener"><span class="type">GSocketListener</span></a> *listener</code></em>,
305                                <em class="parameter"><code><a class="link" href="GSocketAddress.html" title="GSocketAddress"><span class="type">GSocketAddress</span></a> *address</code></em>,
306                                <em class="parameter"><code><a class="link" href="GSocket.html#GSocketType" title="enum GSocketType"><span class="type">GSocketType</span></a> type</code></em>,
307                                <em class="parameter"><code><a class="link" href="GSocket.html#GSocketProtocol" title="enum GSocketProtocol"><span class="type">GSocketProtocol</span></a> protocol</code></em>,
308                                <em class="parameter"><code><a href="../gobject-The-Base-Object-Type.html#GObject-struct"><span class="type">GObject</span></a> *source_object</code></em>,
309                                <em class="parameter"><code><a class="link" href="GSocketAddress.html" title="GSocketAddress"><span class="type">GSocketAddress</span></a> **effective_address</code></em>,
310                                <em class="parameter"><code><a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
311 <p>Creates a socket of type <em class="parameter"><code>type</code></em>
312  and protocol <em class="parameter"><code>protocol</code></em>
313 , binds
314 it to <em class="parameter"><code>address</code></em>
315  and adds it to the set of sockets we're accepting
316 sockets from.</p>
317 <p>Note that adding an IPv6 address, depending on the platform,
318 may or may not result in a listener that also accepts IPv4
319 connections.  For more deterministic behavior, see
320 <a class="link" href="GSocketListener.html#g-socket-listener-add-inet-port" title="g_socket_listener_add_inet_port ()"><code class="function">g_socket_listener_add_inet_port()</code></a>.</p>
321 <p><em class="parameter"><code>source_object</code></em>
322  will be passed out in the various calls
323 to accept to identify this particular source, which is
324 useful if you're listening on multiple addresses and do
325 different things depending on what address is connected to.</p>
326 <p>If successful and <em class="parameter"><code>effective_address</code></em>
327  is non-<a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> then it will
328 be set to the address that the binding actually occurred at.  This
329 is helpful for determining the port number that was used for when
330 requesting a binding to port 0 (ie: "any port").  This address, if
331 requested, belongs to the caller and must be freed.</p>
332 <div class="refsect3">
333 <a name="g-socket-listener-add-address.parameters"></a><h4>Parameters</h4>
334 <div class="informaltable"><table class="informaltable" width="100%" border="0">
335 <colgroup>
336 <col width="150px" class="parameters_name">
337 <col class="parameters_description">
338 <col width="200px" class="parameters_annotations">
339 </colgroup>
340 <tbody>
341 <tr>
342 <td class="parameter_name"><p>listener</p></td>
343 <td class="parameter_description"><p>a <a class="link" href="GSocketListener.html" title="GSocketListener"><span class="type">GSocketListener</span></a></p></td>
344 <td class="parameter_annotations"> </td>
345 </tr>
346 <tr>
347 <td class="parameter_name"><p>address</p></td>
348 <td class="parameter_description"><p>a <a class="link" href="GSocketAddress.html" title="GSocketAddress"><span class="type">GSocketAddress</span></a></p></td>
349 <td class="parameter_annotations"> </td>
350 </tr>
351 <tr>
352 <td class="parameter_name"><p>type</p></td>
353 <td class="parameter_description"><p>a <a class="link" href="GSocket.html#GSocketType" title="enum GSocketType"><span class="type">GSocketType</span></a></p></td>
354 <td class="parameter_annotations"> </td>
355 </tr>
356 <tr>
357 <td class="parameter_name"><p>protocol</p></td>
358 <td class="parameter_description"><p>a <a class="link" href="GSocket.html#GSocketProtocol" title="enum GSocketProtocol"><span class="type">GSocketProtocol</span></a></p></td>
359 <td class="parameter_annotations"> </td>
360 </tr>
361 <tr>
362 <td class="parameter_name"><p>source_object</p></td>
363 <td class="parameter_description"><p> Optional <a href="../gobject-The-Base-Object-Type.html#GObject-struct"><span class="type">GObject</span></a> identifying this source. </p></td>
364 <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
365 </tr>
366 <tr>
367 <td class="parameter_name"><p>effective_address</p></td>
368 <td class="parameter_description"><p> location to store the address that was bound to, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td>
369 <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
370 </tr>
371 <tr>
372 <td class="parameter_name"><p>error</p></td>
373 <td class="parameter_description"><p><a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a> for error reporting, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore.</p></td>
374 <td class="parameter_annotations"> </td>
375 </tr>
376 </tbody>
377 </table></div>
378 </div>
379 <div class="refsect3">
380 <a name="g-socket-listener-add-address.returns"></a><h4>Returns</h4>
381 <p> <a href="../glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> on success, <a href="../glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> on error.</p>
382 </div>
383 <p class="since">Since: <a class="link" href="api-index-2-22.html#api-index-2.22">2.22</a></p>
384 </div>
385 <hr>
386 <div class="refsect2">
387 <a name="g-socket-listener-add-inet-port"></a><h3>g_socket_listener_add_inet_port ()</h3>
388 <pre class="programlisting"><a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
389 g_socket_listener_add_inet_port (<em class="parameter"><code><a class="link" href="GSocketListener.html" title="GSocketListener"><span class="type">GSocketListener</span></a> *listener</code></em>,
390                                  <em class="parameter"><code><a href="../glib-Basic-Types.html#guint16"><span class="type">guint16</span></a> port</code></em>,
391                                  <em class="parameter"><code><a href="../gobject-The-Base-Object-Type.html#GObject-struct"><span class="type">GObject</span></a> *source_object</code></em>,
392                                  <em class="parameter"><code><a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
393 <p>Helper function for <a class="link" href="GSocketListener.html#g-socket-listener-add-address" title="g_socket_listener_add_address ()"><code class="function">g_socket_listener_add_address()</code></a> that
394 creates a TCP/IP socket listening on IPv4 and IPv6 (if
395 supported) on the specified port on all interfaces.</p>
396 <p><em class="parameter"><code>source_object</code></em>
397  will be passed out in the various calls
398 to accept to identify this particular source, which is
399 useful if you're listening on multiple addresses and do
400 different things depending on what address is connected to.</p>
401 <div class="refsect3">
402 <a name="g-socket-listener-add-inet-port.parameters"></a><h4>Parameters</h4>
403 <div class="informaltable"><table class="informaltable" width="100%" border="0">
404 <colgroup>
405 <col width="150px" class="parameters_name">
406 <col class="parameters_description">
407 <col width="200px" class="parameters_annotations">
408 </colgroup>
409 <tbody>
410 <tr>
411 <td class="parameter_name"><p>listener</p></td>
412 <td class="parameter_description"><p>a <a class="link" href="GSocketListener.html" title="GSocketListener"><span class="type">GSocketListener</span></a></p></td>
413 <td class="parameter_annotations"> </td>
414 </tr>
415 <tr>
416 <td class="parameter_name"><p>port</p></td>
417 <td class="parameter_description"><p>an IP port number (non-zero)</p></td>
418 <td class="parameter_annotations"> </td>
419 </tr>
420 <tr>
421 <td class="parameter_name"><p>source_object</p></td>
422 <td class="parameter_description"><p> Optional <a href="../gobject-The-Base-Object-Type.html#GObject-struct"><span class="type">GObject</span></a> identifying this source. </p></td>
423 <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
424 </tr>
425 <tr>
426 <td class="parameter_name"><p>error</p></td>
427 <td class="parameter_description"><p><a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a> for error reporting, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore.</p></td>
428 <td class="parameter_annotations"> </td>
429 </tr>
430 </tbody>
431 </table></div>
432 </div>
433 <div class="refsect3">
434 <a name="g-socket-listener-add-inet-port.returns"></a><h4>Returns</h4>
435 <p> <a href="../glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> on success, <a href="../glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> on error.</p>
436 </div>
437 <p class="since">Since: <a class="link" href="api-index-2-22.html#api-index-2.22">2.22</a></p>
438 </div>
439 <hr>
440 <div class="refsect2">
441 <a name="g-socket-listener-add-any-inet-port"></a><h3>g_socket_listener_add_any_inet_port ()</h3>
442 <pre class="programlisting"><a href="../glib-Basic-Types.html#guint16"><span class="returnvalue">guint16</span></a>
443 g_socket_listener_add_any_inet_port (<em class="parameter"><code><a class="link" href="GSocketListener.html" title="GSocketListener"><span class="type">GSocketListener</span></a> *listener</code></em>,
444                                      <em class="parameter"><code><a href="../gobject-The-Base-Object-Type.html#GObject-struct"><span class="type">GObject</span></a> *source_object</code></em>,
445                                      <em class="parameter"><code><a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
446 <p>Listens for TCP connections on any available port number for both
447 IPv6 and IPv4 (if each is available).</p>
448 <p>This is useful if you need to have a socket for incoming connections
449 but don't care about the specific port number.</p>
450 <p><em class="parameter"><code>source_object</code></em>
451  will be passed out in the various calls
452 to accept to identify this particular source, which is
453 useful if you're listening on multiple addresses and do
454 different things depending on what address is connected to.</p>
455 <div class="refsect3">
456 <a name="g-socket-listener-add-any-inet-port.parameters"></a><h4>Parameters</h4>
457 <div class="informaltable"><table class="informaltable" width="100%" border="0">
458 <colgroup>
459 <col width="150px" class="parameters_name">
460 <col class="parameters_description">
461 <col width="200px" class="parameters_annotations">
462 </colgroup>
463 <tbody>
464 <tr>
465 <td class="parameter_name"><p>listener</p></td>
466 <td class="parameter_description"><p>a <a class="link" href="GSocketListener.html" title="GSocketListener"><span class="type">GSocketListener</span></a></p></td>
467 <td class="parameter_annotations"> </td>
468 </tr>
469 <tr>
470 <td class="parameter_name"><p>source_object</p></td>
471 <td class="parameter_description"><p> Optional <a href="../gobject-The-Base-Object-Type.html#GObject-struct"><span class="type">GObject</span></a> identifying this source. </p></td>
472 <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
473 </tr>
474 <tr>
475 <td class="parameter_name"><p>error</p></td>
476 <td class="parameter_description"><p>a <a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a> location to store the error occurring, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to
477 ignore.</p></td>
478 <td class="parameter_annotations"> </td>
479 </tr>
480 </tbody>
481 </table></div>
482 </div>
483 <div class="refsect3">
484 <a name="g-socket-listener-add-any-inet-port.returns"></a><h4>Returns</h4>
485 <p> the port number, or 0 in case of failure.</p>
486 </div>
487 <p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
488 </div>
489 <hr>
490 <div class="refsect2">
491 <a name="g-socket-listener-accept"></a><h3>g_socket_listener_accept ()</h3>
492 <pre class="programlisting"><a class="link" href="GSocketConnection.html" title="GSocketConnection"><span class="returnvalue">GSocketConnection</span></a> *
493 g_socket_listener_accept (<em class="parameter"><code><a class="link" href="GSocketListener.html" title="GSocketListener"><span class="type">GSocketListener</span></a> *listener</code></em>,
494                           <em class="parameter"><code><a href="../gobject-The-Base-Object-Type.html#GObject-struct"><span class="type">GObject</span></a> **source_object</code></em>,
495                           <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
496                           <em class="parameter"><code><a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
497 <p>Blocks waiting for a client to connect to any of the sockets added
498 to the listener. Returns a <a class="link" href="GSocketConnection.html" title="GSocketConnection"><span class="type">GSocketConnection</span></a> for the socket that was
499 accepted.</p>
500 <p>If <em class="parameter"><code>source_object</code></em>
501  is not <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> it will be filled out with the source
502 object specified when the corresponding socket or address was added
503 to the listener.</p>
504 <p>If <em class="parameter"><code>cancellable</code></em>
505  is not <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, then the operation can be cancelled by
506 triggering the cancellable object from another thread. If the operation
507 was cancelled, the error <a class="link" href="gio-GIOError.html#G-IO-ERROR-CANCELLED:CAPS"><code class="literal">G_IO_ERROR_CANCELLED</code></a> will be returned.</p>
508 <div class="refsect3">
509 <a name="g-socket-listener-accept.parameters"></a><h4>Parameters</h4>
510 <div class="informaltable"><table class="informaltable" width="100%" border="0">
511 <colgroup>
512 <col width="150px" class="parameters_name">
513 <col class="parameters_description">
514 <col width="200px" class="parameters_annotations">
515 </colgroup>
516 <tbody>
517 <tr>
518 <td class="parameter_name"><p>listener</p></td>
519 <td class="parameter_description"><p>a <a class="link" href="GSocketListener.html" title="GSocketListener"><span class="type">GSocketListener</span></a></p></td>
520 <td class="parameter_annotations"> </td>
521 </tr>
522 <tr>
523 <td class="parameter_name"><p>source_object</p></td>
524 <td class="parameter_description"><p> location where <a href="../gobject-The-Base-Object-Type.html#GObject-struct"><span class="type">GObject</span></a> pointer will be stored, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td>
525 <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
526 </tr>
527 <tr>
528 <td class="parameter_name"><p>cancellable</p></td>
529 <td class="parameter_description"><p> optional <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> object, <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore. </p></td>
530 <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
531 </tr>
532 <tr>
533 <td class="parameter_name"><p>error</p></td>
534 <td class="parameter_description"><p><a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a> for error reporting, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore.</p></td>
535 <td class="parameter_annotations"> </td>
536 </tr>
537 </tbody>
538 </table></div>
539 </div>
540 <div class="refsect3">
541 <a name="g-socket-listener-accept.returns"></a><h4>Returns</h4>
542 <p> a <a class="link" href="GSocketConnection.html" title="GSocketConnection"><span class="type">GSocketConnection</span></a> on success, <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on error. </p>
543 <p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
544 </div>
545 <p class="since">Since: <a class="link" href="api-index-2-22.html#api-index-2.22">2.22</a></p>
546 </div>
547 <hr>
548 <div class="refsect2">
549 <a name="g-socket-listener-accept-async"></a><h3>g_socket_listener_accept_async ()</h3>
550 <pre class="programlisting"><span class="returnvalue">void</span>
551 g_socket_listener_accept_async (<em class="parameter"><code><a class="link" href="GSocketListener.html" title="GSocketListener"><span class="type">GSocketListener</span></a> *listener</code></em>,
552                                 <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
553                                 <em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>,
554                                 <em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
555 <p>This is the asynchronous version of <a class="link" href="GSocketListener.html#g-socket-listener-accept" title="g_socket_listener_accept ()"><code class="function">g_socket_listener_accept()</code></a>.</p>
556 <p>When the operation is finished <em class="parameter"><code>callback</code></em>
557  will be
558 called. You can then call <a class="link" href="GSocketListener.html#g-socket-listener-accept-socket" title="g_socket_listener_accept_socket ()"><code class="function">g_socket_listener_accept_socket()</code></a>
559 to get the result of the operation.</p>
560 <div class="refsect3">
561 <a name="g-socket-listener-accept-async.parameters"></a><h4>Parameters</h4>
562 <div class="informaltable"><table class="informaltable" width="100%" border="0">
563 <colgroup>
564 <col width="150px" class="parameters_name">
565 <col class="parameters_description">
566 <col width="200px" class="parameters_annotations">
567 </colgroup>
568 <tbody>
569 <tr>
570 <td class="parameter_name"><p>listener</p></td>
571 <td class="parameter_description"><p>a <a class="link" href="GSocketListener.html" title="GSocketListener"><span class="type">GSocketListener</span></a></p></td>
572 <td class="parameter_annotations"> </td>
573 </tr>
574 <tr>
575 <td class="parameter_name"><p>cancellable</p></td>
576 <td class="parameter_description"><p> a <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a>, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td>
577 <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
578 </tr>
579 <tr>
580 <td class="parameter_name"><p>callback</p></td>
581 <td class="parameter_description"><p> a <a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a>. </p></td>
582 <td class="parameter_annotations"><span class="annotation">[<acronym title="The callback is valid until first called."><span class="acronym">scope async</span></acronym>]</span></td>
583 </tr>
584 <tr>
585 <td class="parameter_name"><p>user_data</p></td>
586 <td class="parameter_description"><p> user data for the callback. </p></td>
587 <td class="parameter_annotations"><span class="annotation">[<acronym title="This parameter is a 'user_data', for callbacks; many bindings can pass NULL here."><span class="acronym">closure</span></acronym>]</span></td>
588 </tr>
589 </tbody>
590 </table></div>
591 </div>
592 <p class="since">Since: <a class="link" href="api-index-2-22.html#api-index-2.22">2.22</a></p>
593 </div>
594 <hr>
595 <div class="refsect2">
596 <a name="g-socket-listener-accept-finish"></a><h3>g_socket_listener_accept_finish ()</h3>
597 <pre class="programlisting"><a class="link" href="GSocketConnection.html" title="GSocketConnection"><span class="returnvalue">GSocketConnection</span></a> *
598 g_socket_listener_accept_finish (<em class="parameter"><code><a class="link" href="GSocketListener.html" title="GSocketListener"><span class="type">GSocketListener</span></a> *listener</code></em>,
599                                  <em class="parameter"><code><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *result</code></em>,
600                                  <em class="parameter"><code><a href="../gobject-The-Base-Object-Type.html#GObject-struct"><span class="type">GObject</span></a> **source_object</code></em>,
601                                  <em class="parameter"><code><a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
602 <p>Finishes an async accept operation. See <a class="link" href="GSocketListener.html#g-socket-listener-accept-async" title="g_socket_listener_accept_async ()"><code class="function">g_socket_listener_accept_async()</code></a></p>
603 <div class="refsect3">
604 <a name="g-socket-listener-accept-finish.parameters"></a><h4>Parameters</h4>
605 <div class="informaltable"><table class="informaltable" width="100%" border="0">
606 <colgroup>
607 <col width="150px" class="parameters_name">
608 <col class="parameters_description">
609 <col width="200px" class="parameters_annotations">
610 </colgroup>
611 <tbody>
612 <tr>
613 <td class="parameter_name"><p>listener</p></td>
614 <td class="parameter_description"><p>a <a class="link" href="GSocketListener.html" title="GSocketListener"><span class="type">GSocketListener</span></a></p></td>
615 <td class="parameter_annotations"> </td>
616 </tr>
617 <tr>
618 <td class="parameter_name"><p>result</p></td>
619 <td class="parameter_description"><p>a <a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a>.</p></td>
620 <td class="parameter_annotations"> </td>
621 </tr>
622 <tr>
623 <td class="parameter_name"><p>source_object</p></td>
624 <td class="parameter_description"><p> Optional <a href="../gobject-The-Base-Object-Type.html#GObject-struct"><span class="type">GObject</span></a> identifying this source. </p></td>
625 <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
626 </tr>
627 <tr>
628 <td class="parameter_name"><p>error</p></td>
629 <td class="parameter_description"><p>a <a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a> location to store the error occurring, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to
630 ignore.</p></td>
631 <td class="parameter_annotations"> </td>
632 </tr>
633 </tbody>
634 </table></div>
635 </div>
636 <div class="refsect3">
637 <a name="g-socket-listener-accept-finish.returns"></a><h4>Returns</h4>
638 <p> a <a class="link" href="GSocketConnection.html" title="GSocketConnection"><span class="type">GSocketConnection</span></a> on success, <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on error. </p>
639 <p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
640 </div>
641 <p class="since">Since: <a class="link" href="api-index-2-22.html#api-index-2.22">2.22</a></p>
642 </div>
643 <hr>
644 <div class="refsect2">
645 <a name="g-socket-listener-accept-socket"></a><h3>g_socket_listener_accept_socket ()</h3>
646 <pre class="programlisting"><a class="link" href="GSocket.html" title="GSocket"><span class="returnvalue">GSocket</span></a> *
647 g_socket_listener_accept_socket (<em class="parameter"><code><a class="link" href="GSocketListener.html" title="GSocketListener"><span class="type">GSocketListener</span></a> *listener</code></em>,
648                                  <em class="parameter"><code><a href="../gobject-The-Base-Object-Type.html#GObject-struct"><span class="type">GObject</span></a> **source_object</code></em>,
649                                  <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
650                                  <em class="parameter"><code><a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
651 <p>Blocks waiting for a client to connect to any of the sockets added
652 to the listener. Returns the <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> that was accepted.</p>
653 <p>If you want to accept the high-level <a class="link" href="GSocketConnection.html" title="GSocketConnection"><span class="type">GSocketConnection</span></a>, not a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>,
654 which is often the case, then you should use <a class="link" href="GSocketListener.html#g-socket-listener-accept" title="g_socket_listener_accept ()"><code class="function">g_socket_listener_accept()</code></a>
655 instead.</p>
656 <p>If <em class="parameter"><code>source_object</code></em>
657  is not <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> it will be filled out with the source
658 object specified when the corresponding socket or address was added
659 to the listener.</p>
660 <p>If <em class="parameter"><code>cancellable</code></em>
661  is not <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, then the operation can be cancelled by
662 triggering the cancellable object from another thread. If the operation
663 was cancelled, the error <a class="link" href="gio-GIOError.html#G-IO-ERROR-CANCELLED:CAPS"><code class="literal">G_IO_ERROR_CANCELLED</code></a> will be returned.</p>
664 <div class="refsect3">
665 <a name="g-socket-listener-accept-socket.parameters"></a><h4>Parameters</h4>
666 <div class="informaltable"><table class="informaltable" width="100%" border="0">
667 <colgroup>
668 <col width="150px" class="parameters_name">
669 <col class="parameters_description">
670 <col width="200px" class="parameters_annotations">
671 </colgroup>
672 <tbody>
673 <tr>
674 <td class="parameter_name"><p>listener</p></td>
675 <td class="parameter_description"><p>a <a class="link" href="GSocketListener.html" title="GSocketListener"><span class="type">GSocketListener</span></a></p></td>
676 <td class="parameter_annotations"> </td>
677 </tr>
678 <tr>
679 <td class="parameter_name"><p>source_object</p></td>
680 <td class="parameter_description"><p> location where <a href="../gobject-The-Base-Object-Type.html#GObject-struct"><span class="type">GObject</span></a> pointer will be stored, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td>
681 <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
682 </tr>
683 <tr>
684 <td class="parameter_name"><p>cancellable</p></td>
685 <td class="parameter_description"><p> optional <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> object, <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore. </p></td>
686 <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
687 </tr>
688 <tr>
689 <td class="parameter_name"><p>error</p></td>
690 <td class="parameter_description"><p><a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a> for error reporting, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore.</p></td>
691 <td class="parameter_annotations"> </td>
692 </tr>
693 </tbody>
694 </table></div>
695 </div>
696 <div class="refsect3">
697 <a name="g-socket-listener-accept-socket.returns"></a><h4>Returns</h4>
698 <p> a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> on success, <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on error. </p>
699 <p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
700 </div>
701 <p class="since">Since: <a class="link" href="api-index-2-22.html#api-index-2.22">2.22</a></p>
702 </div>
703 <hr>
704 <div class="refsect2">
705 <a name="g-socket-listener-accept-socket-async"></a><h3>g_socket_listener_accept_socket_async ()</h3>
706 <pre class="programlisting"><span class="returnvalue">void</span>
707 g_socket_listener_accept_socket_async (<em class="parameter"><code><a class="link" href="GSocketListener.html" title="GSocketListener"><span class="type">GSocketListener</span></a> *listener</code></em>,
708                                        <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
709                                        <em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>,
710                                        <em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
711 <p>This is the asynchronous version of <a class="link" href="GSocketListener.html#g-socket-listener-accept-socket" title="g_socket_listener_accept_socket ()"><code class="function">g_socket_listener_accept_socket()</code></a>.</p>
712 <p>When the operation is finished <em class="parameter"><code>callback</code></em>
713  will be
714 called. You can then call <a class="link" href="GSocketListener.html#g-socket-listener-accept-socket-finish" title="g_socket_listener_accept_socket_finish ()"><code class="function">g_socket_listener_accept_socket_finish()</code></a>
715 to get the result of the operation.</p>
716 <div class="refsect3">
717 <a name="g-socket-listener-accept-socket-async.parameters"></a><h4>Parameters</h4>
718 <div class="informaltable"><table class="informaltable" width="100%" border="0">
719 <colgroup>
720 <col width="150px" class="parameters_name">
721 <col class="parameters_description">
722 <col width="200px" class="parameters_annotations">
723 </colgroup>
724 <tbody>
725 <tr>
726 <td class="parameter_name"><p>listener</p></td>
727 <td class="parameter_description"><p>a <a class="link" href="GSocketListener.html" title="GSocketListener"><span class="type">GSocketListener</span></a></p></td>
728 <td class="parameter_annotations"> </td>
729 </tr>
730 <tr>
731 <td class="parameter_name"><p>cancellable</p></td>
732 <td class="parameter_description"><p> a <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a>, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td>
733 <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
734 </tr>
735 <tr>
736 <td class="parameter_name"><p>callback</p></td>
737 <td class="parameter_description"><p> a <a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a>. </p></td>
738 <td class="parameter_annotations"><span class="annotation">[<acronym title="The callback is valid until first called."><span class="acronym">scope async</span></acronym>]</span></td>
739 </tr>
740 <tr>
741 <td class="parameter_name"><p>user_data</p></td>
742 <td class="parameter_description"><p> user data for the callback. </p></td>
743 <td class="parameter_annotations"><span class="annotation">[<acronym title="This parameter is a 'user_data', for callbacks; many bindings can pass NULL here."><span class="acronym">closure</span></acronym>]</span></td>
744 </tr>
745 </tbody>
746 </table></div>
747 </div>
748 <p class="since">Since: <a class="link" href="api-index-2-22.html#api-index-2.22">2.22</a></p>
749 </div>
750 <hr>
751 <div class="refsect2">
752 <a name="g-socket-listener-accept-socket-finish"></a><h3>g_socket_listener_accept_socket_finish ()</h3>
753 <pre class="programlisting"><a class="link" href="GSocket.html" title="GSocket"><span class="returnvalue">GSocket</span></a> *
754 g_socket_listener_accept_socket_finish
755                                (<em class="parameter"><code><a class="link" href="GSocketListener.html" title="GSocketListener"><span class="type">GSocketListener</span></a> *listener</code></em>,
756                                 <em class="parameter"><code><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *result</code></em>,
757                                 <em class="parameter"><code><a href="../gobject-The-Base-Object-Type.html#GObject-struct"><span class="type">GObject</span></a> **source_object</code></em>,
758                                 <em class="parameter"><code><a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
759 <p>Finishes an async accept operation. See <a class="link" href="GSocketListener.html#g-socket-listener-accept-socket-async" title="g_socket_listener_accept_socket_async ()"><code class="function">g_socket_listener_accept_socket_async()</code></a></p>
760 <div class="refsect3">
761 <a name="g-socket-listener-accept-socket-finish.parameters"></a><h4>Parameters</h4>
762 <div class="informaltable"><table class="informaltable" width="100%" border="0">
763 <colgroup>
764 <col width="150px" class="parameters_name">
765 <col class="parameters_description">
766 <col width="200px" class="parameters_annotations">
767 </colgroup>
768 <tbody>
769 <tr>
770 <td class="parameter_name"><p>listener</p></td>
771 <td class="parameter_description"><p>a <a class="link" href="GSocketListener.html" title="GSocketListener"><span class="type">GSocketListener</span></a></p></td>
772 <td class="parameter_annotations"> </td>
773 </tr>
774 <tr>
775 <td class="parameter_name"><p>result</p></td>
776 <td class="parameter_description"><p>a <a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a>.</p></td>
777 <td class="parameter_annotations"> </td>
778 </tr>
779 <tr>
780 <td class="parameter_name"><p>source_object</p></td>
781 <td class="parameter_description"><p> Optional <a href="../gobject-The-Base-Object-Type.html#GObject-struct"><span class="type">GObject</span></a> identifying this source. </p></td>
782 <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
783 </tr>
784 <tr>
785 <td class="parameter_name"><p>error</p></td>
786 <td class="parameter_description"><p>a <a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a> location to store the error occurring, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to
787 ignore.</p></td>
788 <td class="parameter_annotations"> </td>
789 </tr>
790 </tbody>
791 </table></div>
792 </div>
793 <div class="refsect3">
794 <a name="g-socket-listener-accept-socket-finish.returns"></a><h4>Returns</h4>
795 <p> a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> on success, <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on error. </p>
796 <p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
797 </div>
798 <p class="since">Since: <a class="link" href="api-index-2-22.html#api-index-2.22">2.22</a></p>
799 </div>
800 <hr>
801 <div class="refsect2">
802 <a name="g-socket-listener-close"></a><h3>g_socket_listener_close ()</h3>
803 <pre class="programlisting"><span class="returnvalue">void</span>
804 g_socket_listener_close (<em class="parameter"><code><a class="link" href="GSocketListener.html" title="GSocketListener"><span class="type">GSocketListener</span></a> *listener</code></em>);</pre>
805 <p>Closes all the sockets in the listener.</p>
806 <div class="refsect3">
807 <a name="g-socket-listener-close.parameters"></a><h4>Parameters</h4>
808 <div class="informaltable"><table class="informaltable" width="100%" border="0">
809 <colgroup>
810 <col width="150px" class="parameters_name">
811 <col class="parameters_description">
812 <col width="200px" class="parameters_annotations">
813 </colgroup>
814 <tbody><tr>
815 <td class="parameter_name"><p>listener</p></td>
816 <td class="parameter_description"><p>a <a class="link" href="GSocketListener.html" title="GSocketListener"><span class="type">GSocketListener</span></a></p></td>
817 <td class="parameter_annotations"> </td>
818 </tr></tbody>
819 </table></div>
820 </div>
821 <p class="since">Since: <a class="link" href="api-index-2-22.html#api-index-2.22">2.22</a></p>
822 </div>
823 <hr>
824 <div class="refsect2">
825 <a name="g-socket-listener-set-backlog"></a><h3>g_socket_listener_set_backlog ()</h3>
826 <pre class="programlisting"><span class="returnvalue">void</span>
827 g_socket_listener_set_backlog (<em class="parameter"><code><a class="link" href="GSocketListener.html" title="GSocketListener"><span class="type">GSocketListener</span></a> *listener</code></em>,
828                                <em class="parameter"><code><span class="type">int</span> listen_backlog</code></em>);</pre>
829 <p>Sets the listen backlog on the sockets in the listener.</p>
830 <p>See <a class="link" href="GSocket.html#g-socket-set-listen-backlog" title="g_socket_set_listen_backlog ()"><code class="function">g_socket_set_listen_backlog()</code></a> for details</p>
831 <div class="refsect3">
832 <a name="g-socket-listener-set-backlog.parameters"></a><h4>Parameters</h4>
833 <div class="informaltable"><table class="informaltable" width="100%" border="0">
834 <colgroup>
835 <col width="150px" class="parameters_name">
836 <col class="parameters_description">
837 <col width="200px" class="parameters_annotations">
838 </colgroup>
839 <tbody>
840 <tr>
841 <td class="parameter_name"><p>listener</p></td>
842 <td class="parameter_description"><p>a <a class="link" href="GSocketListener.html" title="GSocketListener"><span class="type">GSocketListener</span></a></p></td>
843 <td class="parameter_annotations"> </td>
844 </tr>
845 <tr>
846 <td class="parameter_name"><p>listen_backlog</p></td>
847 <td class="parameter_description"><p>an integer</p></td>
848 <td class="parameter_annotations"> </td>
849 </tr>
850 </tbody>
851 </table></div>
852 </div>
853 <p class="since">Since: <a class="link" href="api-index-2-22.html#api-index-2.22">2.22</a></p>
854 </div>
855 </div>
856 <div class="refsect1">
857 <a name="GSocketListener.other_details"></a><h2>Types and Values</h2>
858 <div class="refsect2">
859 <a name="GSocketListener-struct"></a><h3>GSocketListener</h3>
860 <pre class="programlisting">typedef struct _GSocketListener GSocketListener;</pre>
861 <p>A helper class for network servers to listen for and accept connections.</p>
862 <p class="since">Since: <a class="link" href="api-index-2-22.html#api-index-2.22">2.22</a></p>
863 </div>
864 <hr>
865 <div class="refsect2">
866 <a name="GSocketListenerEvent"></a><h3>enum GSocketListenerEvent</h3>
867 <p>Describes an event occurring on a <a class="link" href="GSocketListener.html" title="GSocketListener"><span class="type">GSocketListener</span></a>. See the
868 <a class="link" href="GSocketListener.html#GSocketListener-event" title="The “event” signal"><span class="type">“event”</span></a> signal for more details.</p>
869 <p>Additional values may be added to this type in the future.</p>
870 <div class="refsect3">
871 <a name="GSocketListenerEvent.members"></a><h4>Members</h4>
872 <div class="informaltable"><table class="informaltable" width="100%" border="0">
873 <colgroup>
874 <col width="300px" class="enum_members_name">
875 <col class="enum_members_description">
876 <col width="200px" class="enum_members_annotations">
877 </colgroup>
878 <tbody>
879 <tr>
880 <td class="enum_member_name"><p><a name="G-SOCKET-LISTENER-BINDING:CAPS"></a>G_SOCKET_LISTENER_BINDING</p></td>
881 <td class="enum_member_description">
882 <p>The listener is about to bind a socket.</p>
883 </td>
884 <td class="enum_member_annotations"> </td>
885 </tr>
886 <tr>
887 <td class="enum_member_name"><p><a name="G-SOCKET-LISTENER-BOUND:CAPS"></a>G_SOCKET_LISTENER_BOUND</p></td>
888 <td class="enum_member_description">
889 <p>The listener has bound a socket.</p>
890 </td>
891 <td class="enum_member_annotations"> </td>
892 </tr>
893 <tr>
894 <td class="enum_member_name"><p><a name="G-SOCKET-LISTENER-LISTENING:CAPS"></a>G_SOCKET_LISTENER_LISTENING</p></td>
895 <td class="enum_member_description">
896 <p>The listener is about to start
897    listening on this socket.</p>
898 </td>
899 <td class="enum_member_annotations"> </td>
900 </tr>
901 <tr>
902 <td class="enum_member_name"><p><a name="G-SOCKET-LISTENER-LISTENED:CAPS"></a>G_SOCKET_LISTENER_LISTENED</p></td>
903 <td class="enum_member_description">
904 <p>The listener is now listening on
905   this socket.</p>
906 </td>
907 <td class="enum_member_annotations"> </td>
908 </tr>
909 </tbody>
910 </table></div>
911 </div>
912 <p class="since">Since: <a class="link" href="api-index-2-46.html#api-index-2.46">2.46</a></p>
913 </div>
914 </div>
915 <div class="refsect1">
916 <a name="GSocketListener.property-details"></a><h2>Property Details</h2>
917 <div class="refsect2">
918 <a name="GSocketListener--listen-backlog"></a><h3>The <code class="literal">“listen-backlog”</code> property</h3>
919 <pre class="programlisting">  “listen-backlog”           <a href="../glib-Basic-Types.html#gint"><span class="type">gint</span></a></pre>
920 <p>outstanding connections in the listen queue.</p>
921 <p>Flags: Read / Write / Construct</p>
922 <p>Allowed values: [0,2000]</p>
923 <p>Default value: 10</p>
924 </div>
925 </div>
926 <div class="refsect1">
927 <a name="GSocketListener.signal-details"></a><h2>Signal Details</h2>
928 <div class="refsect2">
929 <a name="GSocketListener-event"></a><h3>The <code class="literal">“event”</code> signal</h3>
930 <pre class="programlisting"><span class="returnvalue">void</span>
931 user_function (<a class="link" href="GSocketListener.html" title="GSocketListener"><span class="type">GSocketListener</span></a>     *listener,
932                <a class="link" href="GSocketListener.html#GSocketListenerEvent" title="enum GSocketListenerEvent"><span class="type">GSocketListenerEvent</span></a> event,
933                <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>             *socket,
934                <a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>             user_data)</pre>
935 <p>Emitted when <em class="parameter"><code>listener</code></em>
936 's activity on <em class="parameter"><code>socket</code></em>
937  changes state.
938 Note that when <em class="parameter"><code>listener</code></em>
939  is used to listen on both IPv4 and
940 IPv6, a separate set of signals will be emitted for each, and
941 the order they happen in is undefined.</p>
942 <div class="refsect3">
943 <a name="GSocketListener-event.parameters"></a><h4>Parameters</h4>
944 <div class="informaltable"><table class="informaltable" width="100%" border="0">
945 <colgroup>
946 <col width="150px" class="parameters_name">
947 <col class="parameters_description">
948 <col width="200px" class="parameters_annotations">
949 </colgroup>
950 <tbody>
951 <tr>
952 <td class="parameter_name"><p>listener</p></td>
953 <td class="parameter_description"><p>the <a class="link" href="GSocketListener.html" title="GSocketListener"><span class="type">GSocketListener</span></a></p></td>
954 <td class="parameter_annotations"> </td>
955 </tr>
956 <tr>
957 <td class="parameter_name"><p>event</p></td>
958 <td class="parameter_description"><p>the event that is occurring</p></td>
959 <td class="parameter_annotations"> </td>
960 </tr>
961 <tr>
962 <td class="parameter_name"><p>socket</p></td>
963 <td class="parameter_description"><p>the <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> the event is occurring on</p></td>
964 <td class="parameter_annotations"> </td>
965 </tr>
966 <tr>
967 <td class="parameter_name"><p>user_data</p></td>
968 <td class="parameter_description"><p>user data set when the signal handler was connected.</p></td>
969 <td class="parameter_annotations"> </td>
970 </tr>
971 </tbody>
972 </table></div>
973 </div>
974 <p>Flags: <a href="../gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS">Run Last</a></p>
975 <p class="since">Since: <a class="link" href="api-index-2-46.html#api-index-2.46">2.46</a></p>
976 </div>
977 </div>
978 <div class="refsect1">
979 <a name="GSocketListener.see-also"></a><h2>See Also</h2>
980 <p><a class="link" href="GThreadedSocketService.html" title="GThreadedSocketService"><span class="type">GThreadedSocketService</span></a>, <a class="link" href="GSocketService.html" title="GSocketService"><span class="type">GSocketService</span></a>.</p>
981 </div>
982 </div>
983 <div class="footer">
984 <hr>Generated by GTK-Doc V1.25.1</div>
985 </body>
986 </html>