~ubuntu-branches/ubuntu/saucy/glib2.0/saucy-proposed

« back to all changes in this revision

Viewing changes to docs/reference/gio/html/GSocket.html

  • Committer: Package Import Robot
  • Author(s): Iain Lane
  • Date: 2013-08-21 10:08:49 UTC
  • mfrom: (1.63.24)
  • Revision ID: package-import@ubuntu.com-20130821100849-enhti9o2tk0iug5r
Tags: 2.37.6-1ubuntu1
* Resynchronise with Debian, remaining change:
  - Build-Depend on python:any for cross-building.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
<html>
3
3
<head>
4
4
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
 
<title>GSocket</title>
 
5
<title>GIO Reference Manual: GSocket</title>
6
6
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
7
7
<link rel="home" href="index.html" title="GIO Reference Manual">
8
8
<link rel="up" href="networking.html" title="Low-level network support">
12
12
<link rel="stylesheet" href="style.css" type="text/css">
13
13
</head>
14
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="2">
16
 
<tr valign="middle">
17
 
<td><a accesskey="p" href="networking.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
18
 
<td><a accesskey="u" href="networking.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
19
 
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
20
 
<th width="100%" align="center">GIO Reference Manual</th>
21
 
<td><a accesskey="n" href="GInetAddress.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
22
 
</tr>
23
 
<tr><td colspan="5" class="shortcuts">
24
 
<a href="#GSocket.synopsis" class="shortcut">Top</a>
 
15
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="10"><tr valign="middle">
 
16
<td width="100%" align="left">
 
17
<a href="#" class="shortcut">Top</a>
25
18
                   | 
26
19
                  <a href="#GSocket.description" class="shortcut">Description</a>
27
20
                   | 
30
23
                  <a href="#GSocket.implemented-interfaces" class="shortcut">Implemented Interfaces</a>
31
24
                   | 
32
25
                  <a href="#GSocket.properties" class="shortcut">Properties</a>
33
 
</td></tr>
34
 
</table>
 
26
</td>
 
27
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
 
28
<td><a accesskey="u" href="networking.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
 
29
<td><a accesskey="p" href="networking.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
 
30
<td><a accesskey="n" href="GInetAddress.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
 
31
</tr></table>
35
32
<div class="refentry">
36
33
<a name="GSocket"></a><div class="titlepage"></div>
37
34
<div class="refnamediv"><table width="100%"><tr>
675
672
used to initiate connections, though this is not normally required.
676
673
</p>
677
674
<p>
678
 
<em class="parameter"><code>allow_reuse</code></em> should be <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> for server sockets (sockets that you will
679
 
eventually call <a class="link" href="GSocket.html#g-socket-accept" title="g_socket_accept ()"><code class="function">g_socket_accept()</code></a> on), and <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> for client sockets.
680
 
(Specifically, if it is <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>, then <a class="link" href="GSocket.html#g-socket-bind" title="g_socket_bind ()"><code class="function">g_socket_bind()</code></a> will set the
681
 
<code class="literal">SO_REUSEADDR</code> flag on the socket, allowing it to bind <em class="parameter"><code>address</code></em> even if
682
 
that address was previously used by another socket that has not yet been
683
 
fully cleaned-up by the kernel. Failing to set this flag on a server
684
 
socket may cause the bind call to return <a class="link" href="gio-GIOError.html#G-IO-ERROR-ADDRESS-IN-USE:CAPS"><code class="literal">G_IO_ERROR_ADDRESS_IN_USE</code></a> if
685
 
the server program is stopped and then immediately restarted.)
 
675
If <em class="parameter"><code>socket</code></em> is a TCP socket, then <em class="parameter"><code>allow_reuse</code></em> controls the setting
 
676
of the <code class="literal">SO_REUSEADDR</code> socket option; normally it
 
677
should be <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> for server sockets (sockets that you will
 
678
eventually call <a class="link" href="GSocket.html#g-socket-accept" title="g_socket_accept ()"><code class="function">g_socket_accept()</code></a> on), and <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> for client
 
679
sockets. (Failing to set this flag on a server socket may cause
 
680
<a class="link" href="GSocket.html#g-socket-bind" title="g_socket_bind ()"><code class="function">g_socket_bind()</code></a> to return <a class="link" href="gio-GIOError.html#G-IO-ERROR-ADDRESS-IN-USE:CAPS"><code class="literal">G_IO_ERROR_ADDRESS_IN_USE</code></a> if the server
 
681
program is stopped and then immediately restarted.)
 
682
</p>
 
683
<p>
 
684
If <em class="parameter"><code>socket</code></em> is a UDP socket, then <em class="parameter"><code>allow_reuse</code></em> determines whether or
 
685
not other UDP sockets can be bound to the same address at the same
 
686
time. In particular, you can have several UDP sockets bound to the
 
687
same address, and they will all receive all of the multicast and
 
688
broadcast packets sent to that address. (The behavior of unicast
 
689
UDP packets to an address with multiple listeners is not defined.)
686
690
</p>
687
691
<div class="variablelist"><table border="0" class="variablelist">
688
692
<colgroup>
2310
2314
<p>
2311
2315
Gets the broadcast setting on <em class="parameter"><code>socket</code></em>; if <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>,
2312
2316
it is possible to send packets to broadcast
2313
 
addresses or receive from broadcast addresses.
 
2317
addresses.
2314
2318
</p>
2315
2319
<div class="variablelist"><table border="0" class="variablelist">
2316
2320
<colgroup>
2337
2341
<pre class="programlisting"><span class="returnvalue">void</span>                g_socket_set_broadcast              (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
2338
2342
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> broadcast</code></em>);</pre>
2339
2343
<p>
2340
 
Sets whether <em class="parameter"><code>socket</code></em> should allow sending to and receiving from
2341
 
broadcast addresses. This is <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> by default.
 
2344
Sets whether <em class="parameter"><code>socket</code></em> should allow sending to broadcast addresses.
 
2345
This is <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> by default.
2342
2346
</p>
2343
2347
<div class="variablelist"><table border="0" class="variablelist">
2344
2348
<colgroup>
2352
2356
</tr>
2353
2357
<tr>
2354
2358
<td><p><span class="term"><em class="parameter"><code>broadcast</code></em> :</span></p></td>
2355
 
<td>whether <em class="parameter"><code>socket</code></em> should allow sending to and receiving
2356
 
from broadcast addresses</td>
 
2359
<td>whether <em class="parameter"><code>socket</code></em> should allow sending to broadcast
 
2360
addresses</td>
2357
2361
</tr>
2358
2362
</tbody>
2359
2363
</table></div>
2783
2787
<td>a <a class="link" href="GInetAddress.html" title="GInetAddress"><span class="type">GInetAddress</span></a> specifying the group address to join.</td>
2784
2788
</tr>
2785
2789
<tr>
 
2790
<td><p><span class="term"><em class="parameter"><code>source_specific</code></em> :</span></p></td>
 
2791
<td>
 
2792
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if source-specific multicast should be used</td>
 
2793
</tr>
 
2794
<tr>
2786
2795
<td><p><span class="term"><em class="parameter"><code>iface</code></em> :</span></p></td>
2787
2796
<td>Name of the interface to use, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
2788
2797
</td>
2789
2798
</tr>
2790
2799
<tr>
2791
 
<td><p><span class="term"><em class="parameter"><code>source_specific</code></em> :</span></p></td>
2792
 
<td>
2793
 
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if source-specific multicast should be used</td>
2794
 
</tr>
2795
 
<tr>
2796
2800
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
2797
2801
<td>
2798
2802
<a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> for error reporting, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore.</td>
2838
2842
<td>a <a class="link" href="GInetAddress.html" title="GInetAddress"><span class="type">GInetAddress</span></a> specifying the group address to leave.</td>
2839
2843
</tr>
2840
2844
<tr>
 
2845
<td><p><span class="term"><em class="parameter"><code>source_specific</code></em> :</span></p></td>
 
2846
<td>
 
2847
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if source-specific multicast was used</td>
 
2848
</tr>
 
2849
<tr>
2841
2850
<td><p><span class="term"><em class="parameter"><code>iface</code></em> :</span></p></td>
2842
2851
<td>Interface used. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
2843
2852
</td>
2844
2853
</tr>
2845
2854
<tr>
2846
 
<td><p><span class="term"><em class="parameter"><code>source_specific</code></em> :</span></p></td>
2847
 
<td>
2848
 
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if source-specific multicast was used</td>
2849
 
</tr>
2850
 
<tr>
2851
2855
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
2852
2856
<td>
2853
2857
<a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> for error reporting, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore.</td>
2988
2992
<a name="GSocket--broadcast"></a><h3>The <code class="literal">"broadcast"</code> property</h3>
2989
2993
<pre class="programlisting">  "broadcast"                <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>              : Read / Write</pre>
2990
2994
<p>
2991
 
Whether the socket should allow sending to and receiving from broadcast addresses.
 
2995
Whether the socket should allow sending to broadcast addresses.
2992
2996
</p>
2993
2997
<p>Default value: FALSE</p>
2994
2998
<p class="since">Since 2.32</p>