Tizen 2.1 base
[platform/upstream/glib2.0.git] / docs / reference / gio / html / GSocket.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>GSocket</title>
6 <meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
7 <link rel="home" href="index.html" title="GIO Reference Manual">
8 <link rel="up" href="networking.html" title="Low-level network support">
9 <link rel="prev" href="networking.html" title="Low-level network support">
10 <link rel="next" href="GInetAddress.html" title="GInetAddress">
11 <meta name="generator" content="GTK-Doc V1.18 (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="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>
25                    | 
26                   <a href="#GSocket.description" class="shortcut">Description</a>
27                    | 
28                   <a href="#GSocket.object-hierarchy" class="shortcut">Object Hierarchy</a>
29                    | 
30                   <a href="#GSocket.implemented-interfaces" class="shortcut">Implemented Interfaces</a>
31                    | 
32                   <a href="#GSocket.properties" class="shortcut">Properties</a>
33 </td></tr>
34 </table>
35 <div class="refentry">
36 <a name="GSocket"></a><div class="titlepage"></div>
37 <div class="refnamediv"><table width="100%"><tr>
38 <td valign="top">
39 <h2><span class="refentrytitle"><a name="GSocket.top_of_page"></a>GSocket</span></h2>
40 <p>GSocket — Low-level socket object</p>
41 </td>
42 <td valign="top" align="right"></td>
43 </tr></table></div>
44 <div class="refsynopsisdiv">
45 <a name="GSocket.synopsis"></a><h2>Synopsis</h2>
46 <pre class="synopsis">
47 #include &lt;gio/gio.h&gt;
48
49                     <a class="link" href="GSocket.html#GSocket-struct" title="GSocket">GSocket</a>;
50 <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            (<a class="link" href="GSocket.html#GSocketSourceFunc" title="GSocketSourceFunc ()">*GSocketSourceFunc</a>)                (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
51                                                          <em class="parameter"><code><a href="./../glib/glib/glib-IO-Channels.html#GIOCondition"><span class="type">GIOCondition</span></a> condition</code></em>,
52                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);
53 enum                <a class="link" href="GSocket.html#GSocketType" title="enum GSocketType">GSocketType</a>;
54 enum                <a class="link" href="GSocket.html#GSocketProtocol" title="enum GSocketProtocol">GSocketProtocol</a>;
55 enum                <a class="link" href="GSocket.html#GSocketMsgFlags" title="enum GSocketMsgFlags">GSocketMsgFlags</a>;
56 struct              <a class="link" href="GSocket.html#GInputVector" title="struct GInputVector">GInputVector</a>;
57 struct              <a class="link" href="GSocket.html#GOutputVector" title="struct GOutputVector">GOutputVector</a>;
58 <a class="link" href="GSocket.html" title="GSocket"><span class="returnvalue">GSocket</span></a> *           <a class="link" href="GSocket.html#g-socket-new" title="g_socket_new ()">g_socket_new</a>                        (<em class="parameter"><code><a class="link" href="GSocketAddress.html#GSocketFamily" title="enum GSocketFamily"><span class="type">GSocketFamily</span></a> family</code></em>,
59                                                          <em class="parameter"><code><a class="link" href="GSocket.html#GSocketType" title="enum GSocketType"><span class="type">GSocketType</span></a> type</code></em>,
60                                                          <em class="parameter"><code><a class="link" href="GSocket.html#GSocketProtocol" title="enum GSocketProtocol"><span class="type">GSocketProtocol</span></a> protocol</code></em>,
61                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
62 <a class="link" href="GSocket.html" title="GSocket"><span class="returnvalue">GSocket</span></a> *           <a class="link" href="GSocket.html#g-socket-new-from-fd" title="g_socket_new_from_fd ()">g_socket_new_from_fd</a>                (<em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> fd</code></em>,
63                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
64 <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="GSocket.html#g-socket-bind" title="g_socket_bind ()">g_socket_bind</a>                       (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
65                                                          <em class="parameter"><code><a class="link" href="GSocketAddress.html" title="GSocketAddress"><span class="type">GSocketAddress</span></a> *address</code></em>,
66                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> allow_reuse</code></em>,
67                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
68 <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="GSocket.html#g-socket-listen" title="g_socket_listen ()">g_socket_listen</a>                     (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
69                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
70 <a class="link" href="GSocket.html" title="GSocket"><span class="returnvalue">GSocket</span></a> *           <a class="link" href="GSocket.html#g-socket-accept" title="g_socket_accept ()">g_socket_accept</a>                     (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
71                                                          <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
72                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
73 <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="GSocket.html#g-socket-connect" title="g_socket_connect ()">g_socket_connect</a>                    (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
74                                                          <em class="parameter"><code><a class="link" href="GSocketAddress.html" title="GSocketAddress"><span class="type">GSocketAddress</span></a> *address</code></em>,
75                                                          <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
76                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
77 <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="GSocket.html#g-socket-check-connect-result" title="g_socket_check_connect_result ()">g_socket_check_connect_result</a>       (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
78                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
79 <a href="./../glib/glib/glib-Basic-Types.html#gssize"><span class="returnvalue">gssize</span></a>              <a class="link" href="GSocket.html#g-socket-receive" title="g_socket_receive ()">g_socket_receive</a>                    (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
80                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *buffer</code></em>,
81                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gsize"><span class="type">gsize</span></a> size</code></em>,
82                                                          <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
83                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
84 <a href="./../glib/glib/glib-Basic-Types.html#gssize"><span class="returnvalue">gssize</span></a>              <a class="link" href="GSocket.html#g-socket-receive-from" title="g_socket_receive_from ()">g_socket_receive_from</a>               (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
85                                                          <em class="parameter"><code><a class="link" href="GSocketAddress.html" title="GSocketAddress"><span class="type">GSocketAddress</span></a> **address</code></em>,
86                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *buffer</code></em>,
87                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gsize"><span class="type">gsize</span></a> size</code></em>,
88                                                          <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
89                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
90 <a href="./../glib/glib/glib-Basic-Types.html#gssize"><span class="returnvalue">gssize</span></a>              <a class="link" href="GSocket.html#g-socket-receive-message" title="g_socket_receive_message ()">g_socket_receive_message</a>            (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
91                                                          <em class="parameter"><code><a class="link" href="GSocketAddress.html" title="GSocketAddress"><span class="type">GSocketAddress</span></a> **address</code></em>,
92                                                          <em class="parameter"><code><a class="link" href="GSocket.html#GInputVector" title="struct GInputVector"><span class="type">GInputVector</span></a> *vectors</code></em>,
93                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> num_vectors</code></em>,
94                                                          <em class="parameter"><code><a class="link" href="GSocketControlMessage.html" title="GSocketControlMessage"><span class="type">GSocketControlMessage</span></a> ***messages</code></em>,
95                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> *num_messages</code></em>,
96                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> *flags</code></em>,
97                                                          <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
98                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
99 <a href="./../glib/glib/glib-Basic-Types.html#gssize"><span class="returnvalue">gssize</span></a>              <a class="link" href="GSocket.html#g-socket-receive-with-blocking" title="g_socket_receive_with_blocking ()">g_socket_receive_with_blocking</a>      (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
100                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *buffer</code></em>,
101                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gsize"><span class="type">gsize</span></a> size</code></em>,
102                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> blocking</code></em>,
103                                                          <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
104                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
105 <a href="./../glib/glib/glib-Basic-Types.html#gssize"><span class="returnvalue">gssize</span></a>              <a class="link" href="GSocket.html#g-socket-send" title="g_socket_send ()">g_socket_send</a>                       (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
106                                                          <em class="parameter"><code>const <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *buffer</code></em>,
107                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gsize"><span class="type">gsize</span></a> size</code></em>,
108                                                          <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
109                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
110 <a href="./../glib/glib/glib-Basic-Types.html#gssize"><span class="returnvalue">gssize</span></a>              <a class="link" href="GSocket.html#g-socket-send-to" title="g_socket_send_to ()">g_socket_send_to</a>                    (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
111                                                          <em class="parameter"><code><a class="link" href="GSocketAddress.html" title="GSocketAddress"><span class="type">GSocketAddress</span></a> *address</code></em>,
112                                                          <em class="parameter"><code>const <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *buffer</code></em>,
113                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gsize"><span class="type">gsize</span></a> size</code></em>,
114                                                          <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
115                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
116 <a href="./../glib/glib/glib-Basic-Types.html#gssize"><span class="returnvalue">gssize</span></a>              <a class="link" href="GSocket.html#g-socket-send-message" title="g_socket_send_message ()">g_socket_send_message</a>               (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
117                                                          <em class="parameter"><code><a class="link" href="GSocketAddress.html" title="GSocketAddress"><span class="type">GSocketAddress</span></a> *address</code></em>,
118                                                          <em class="parameter"><code><a class="link" href="GSocket.html#GOutputVector" title="struct GOutputVector"><span class="type">GOutputVector</span></a> *vectors</code></em>,
119                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> num_vectors</code></em>,
120                                                          <em class="parameter"><code><a class="link" href="GSocketControlMessage.html" title="GSocketControlMessage"><span class="type">GSocketControlMessage</span></a> **messages</code></em>,
121                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> num_messages</code></em>,
122                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> flags</code></em>,
123                                                          <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
124                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
125 <a href="./../glib/glib/glib-Basic-Types.html#gssize"><span class="returnvalue">gssize</span></a>              <a class="link" href="GSocket.html#g-socket-send-with-blocking" title="g_socket_send_with_blocking ()">g_socket_send_with_blocking</a>         (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
126                                                          <em class="parameter"><code>const <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *buffer</code></em>,
127                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gsize"><span class="type">gsize</span></a> size</code></em>,
128                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> blocking</code></em>,
129                                                          <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
130                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
131 <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="GSocket.html#g-socket-close" title="g_socket_close ()">g_socket_close</a>                      (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
132                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
133 <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="GSocket.html#g-socket-is-closed" title="g_socket_is_closed ()">g_socket_is_closed</a>                  (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>);
134 <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="GSocket.html#g-socket-shutdown" title="g_socket_shutdown ()">g_socket_shutdown</a>                   (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
135                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> shutdown_read</code></em>,
136                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> shutdown_write</code></em>,
137                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
138 <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="GSocket.html#g-socket-is-connected" title="g_socket_is_connected ()">g_socket_is_connected</a>               (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>);
139 <a href="./../glib/glib/glib-The-Main-Event-Loop.html#GSource"><span class="returnvalue">GSource</span></a> *           <a class="link" href="GSocket.html#g-socket-create-source" title="g_socket_create_source ()">g_socket_create_source</a>              (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
140                                                          <em class="parameter"><code><a href="./../glib/glib/glib-IO-Channels.html#GIOCondition"><span class="type">GIOCondition</span></a> condition</code></em>,
141                                                          <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>);
142 <a href="./../glib/glib/glib-IO-Channels.html#GIOCondition"><span class="returnvalue">GIOCondition</span></a>        <a class="link" href="GSocket.html#g-socket-condition-check" title="g_socket_condition_check ()">g_socket_condition_check</a>            (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
143                                                          <em class="parameter"><code><a href="./../glib/glib/glib-IO-Channels.html#GIOCondition"><span class="type">GIOCondition</span></a> condition</code></em>);
144 <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="GSocket.html#g-socket-condition-wait" title="g_socket_condition_wait ()">g_socket_condition_wait</a>             (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
145                                                          <em class="parameter"><code><a href="./../glib/glib/glib-IO-Channels.html#GIOCondition"><span class="type">GIOCondition</span></a> condition</code></em>,
146                                                          <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
147                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
148 <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="GSocket.html#g-socket-condition-timed-wait" title="g_socket_condition_timed_wait ()">g_socket_condition_timed_wait</a>       (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
149                                                          <em class="parameter"><code><a href="./../glib/glib/glib-IO-Channels.html#GIOCondition"><span class="type">GIOCondition</span></a> condition</code></em>,
150                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gint64"><span class="type">gint64</span></a> timeout</code></em>,
151                                                          <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
152                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
153 <a href="./../glib/glib/glib-Basic-Types.html#gssize"><span class="returnvalue">gssize</span></a>              <a class="link" href="GSocket.html#g-socket-get-available-bytes" title="g_socket_get_available_bytes ()">g_socket_get_available_bytes</a>        (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>);
154 <span class="returnvalue">void</span>                <a class="link" href="GSocket.html#g-socket-set-listen-backlog" title="g_socket_set_listen_backlog ()">g_socket_set_listen_backlog</a>         (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
155                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> backlog</code></em>);
156 <a href="./../glib/glib/glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a>                <a class="link" href="GSocket.html#g-socket-get-listen-backlog" title="g_socket_get_listen_backlog ()">g_socket_get_listen_backlog</a>         (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>);
157 <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="GSocket.html#g-socket-get-blocking" title="g_socket_get_blocking ()">g_socket_get_blocking</a>               (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>);
158 <span class="returnvalue">void</span>                <a class="link" href="GSocket.html#g-socket-set-blocking" title="g_socket_set_blocking ()">g_socket_set_blocking</a>               (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
159                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> blocking</code></em>);
160 <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="GSocket.html#g-socket-get-keepalive" title="g_socket_get_keepalive ()">g_socket_get_keepalive</a>              (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>);
161 <span class="returnvalue">void</span>                <a class="link" href="GSocket.html#g-socket-set-keepalive" title="g_socket_set_keepalive ()">g_socket_set_keepalive</a>              (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
162                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> keepalive</code></em>);
163 <a href="./../glib/glib/glib-Basic-Types.html#guint"><span class="returnvalue">guint</span></a>               <a class="link" href="GSocket.html#g-socket-get-timeout" title="g_socket_get_timeout ()">g_socket_get_timeout</a>                (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>);
164 <span class="returnvalue">void</span>                <a class="link" href="GSocket.html#g-socket-set-timeout" title="g_socket_set_timeout ()">g_socket_set_timeout</a>                (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
165                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#guint"><span class="type">guint</span></a> timeout</code></em>);
166 <span class="returnvalue">void</span>                <a class="link" href="GSocket.html#g-socket-set-ttl" title="g_socket_set_ttl ()">g_socket_set_ttl</a>                    (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
167                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#guint"><span class="type">guint</span></a> ttl</code></em>);
168 <a href="./../glib/glib/glib-Basic-Types.html#guint"><span class="returnvalue">guint</span></a>               <a class="link" href="GSocket.html#g-socket-get-ttl" title="g_socket_get_ttl ()">g_socket_get_ttl</a>                    (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>);
169 <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="GSocket.html#g-socket-get-broadcast" title="g_socket_get_broadcast ()">g_socket_get_broadcast</a>              (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>);
170 <span class="returnvalue">void</span>                <a class="link" href="GSocket.html#g-socket-set-broadcast" title="g_socket_set_broadcast ()">g_socket_set_broadcast</a>              (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
171                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> broadcast</code></em>);
172 <a class="link" href="GSocketAddress.html#GSocketFamily" title="enum GSocketFamily"><span class="returnvalue">GSocketFamily</span></a>       <a class="link" href="GSocket.html#g-socket-get-family" title="g_socket_get_family ()">g_socket_get_family</a>                 (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>);
173 <span class="returnvalue">int</span>                 <a class="link" href="GSocket.html#g-socket-get-fd" title="g_socket_get_fd ()">g_socket_get_fd</a>                     (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>);
174 <a class="link" href="GSocketAddress.html" title="GSocketAddress"><span class="returnvalue">GSocketAddress</span></a> *    <a class="link" href="GSocket.html#g-socket-get-local-address" title="g_socket_get_local_address ()">g_socket_get_local_address</a>          (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
175                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
176 <a class="link" href="GSocket.html#GSocketProtocol" title="enum GSocketProtocol"><span class="returnvalue">GSocketProtocol</span></a>     <a class="link" href="GSocket.html#g-socket-get-protocol" title="g_socket_get_protocol ()">g_socket_get_protocol</a>               (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>);
177 <a class="link" href="GSocketAddress.html" title="GSocketAddress"><span class="returnvalue">GSocketAddress</span></a> *    <a class="link" href="GSocket.html#g-socket-get-remote-address" title="g_socket_get_remote_address ()">g_socket_get_remote_address</a>         (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
178                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
179 <a class="link" href="GSocket.html#GSocketType" title="enum GSocketType"><span class="returnvalue">GSocketType</span></a>         <a class="link" href="GSocket.html#g-socket-get-socket-type" title="g_socket_get_socket_type ()">g_socket_get_socket_type</a>            (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>);
180 <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="GSocket.html#g-socket-speaks-ipv4" title="g_socket_speaks_ipv4 ()">g_socket_speaks_ipv4</a>                (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>);
181 <a class="link" href="GCredentials.html" title="GCredentials"><span class="returnvalue">GCredentials</span></a> *      <a class="link" href="GSocket.html#g-socket-get-credentials" title="g_socket_get_credentials ()">g_socket_get_credentials</a>            (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
182                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
183
184 <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="GSocket.html#g-socket-join-multicast-group" title="g_socket_join_multicast_group ()">g_socket_join_multicast_group</a>       (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
185                                                          <em class="parameter"><code><a class="link" href="GInetAddress.html" title="GInetAddress"><span class="type">GInetAddress</span></a> *group</code></em>,
186                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> source_specific</code></em>,
187                                                          <em class="parameter"><code>const <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *iface</code></em>,
188                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
189 <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="GSocket.html#g-socket-leave-multicast-group" title="g_socket_leave_multicast_group ()">g_socket_leave_multicast_group</a>      (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
190                                                          <em class="parameter"><code><a class="link" href="GInetAddress.html" title="GInetAddress"><span class="type">GInetAddress</span></a> *group</code></em>,
191                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> source_specific</code></em>,
192                                                          <em class="parameter"><code>const <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *iface</code></em>,
193                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
194 <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="GSocket.html#g-socket-get-multicast-loopback" title="g_socket_get_multicast_loopback ()">g_socket_get_multicast_loopback</a>     (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>);
195 <span class="returnvalue">void</span>                <a class="link" href="GSocket.html#g-socket-set-multicast-loopback" title="g_socket_set_multicast_loopback ()">g_socket_set_multicast_loopback</a>     (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
196                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> loopback</code></em>);
197 <a href="./../glib/glib/glib-Basic-Types.html#guint"><span class="returnvalue">guint</span></a>               <a class="link" href="GSocket.html#g-socket-get-multicast-ttl" title="g_socket_get_multicast_ttl ()">g_socket_get_multicast_ttl</a>          (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>);
198 <span class="returnvalue">void</span>                <a class="link" href="GSocket.html#g-socket-set-multicast-ttl" title="g_socket_set_multicast_ttl ()">g_socket_set_multicast_ttl</a>          (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
199                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#guint"><span class="type">guint</span></a> ttl</code></em>);
200 </pre>
201 </div>
202 <div class="refsect1">
203 <a name="GSocket.object-hierarchy"></a><h2>Object Hierarchy</h2>
204 <pre class="synopsis">
205   <a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#GObject">GObject</a>
206    +----GSocket
207 </pre>
208 </div>
209 <div class="refsect1">
210 <a name="GSocket.implemented-interfaces"></a><h2>Implemented Interfaces</h2>
211 <p>
212 GSocket implements
213  <a class="link" href="GInitable.html" title="GInitable">GInitable</a>.</p>
214 </div>
215 <div class="refsect1">
216 <a name="GSocket.properties"></a><h2>Properties</h2>
217 <pre class="synopsis">
218   "<a class="link" href="GSocket.html#GSocket--blocking" title='The "blocking" property'>blocking</a>"                 <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>              : Read / Write
219   "<a class="link" href="GSocket.html#GSocket--broadcast" title='The "broadcast" property'>broadcast</a>"                <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>              : Read / Write
220   "<a class="link" href="GSocket.html#GSocket--family" title='The "family" property'>family</a>"                   <a class="link" href="GSocketAddress.html#GSocketFamily" title="enum GSocketFamily"><span class="type">GSocketFamily</span></a>         : Read / Write / Construct Only
221   "<a class="link" href="GSocket.html#GSocket--fd" title='The "fd" property'>fd</a>"                       <a href="./../glib/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a>                  : Read / Write / Construct Only
222   "<a class="link" href="GSocket.html#GSocket--keepalive" title='The "keepalive" property'>keepalive</a>"                <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>              : Read / Write
223   "<a class="link" href="GSocket.html#GSocket--listen-backlog" title='The "listen-backlog" property'>listen-backlog</a>"           <a href="./../glib/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a>                  : Read / Write
224   "<a class="link" href="GSocket.html#GSocket--local-address" title='The "local-address" property'>local-address</a>"            <a class="link" href="GSocketAddress.html" title="GSocketAddress"><span class="type">GSocketAddress</span></a>*       : Read
225   "<a class="link" href="GSocket.html#GSocket--multicast-loopback" title='The "multicast-loopback" property'>multicast-loopback</a>"       <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>              : Read / Write
226   "<a class="link" href="GSocket.html#GSocket--multicast-ttl" title='The "multicast-ttl" property'>multicast-ttl</a>"            <a href="./../glib/glib/glib-Basic-Types.html#guint"><span class="type">guint</span></a>                 : Read / Write
227   "<a class="link" href="GSocket.html#GSocket--protocol" title='The "protocol" property'>protocol</a>"                 <a class="link" href="GSocket.html#GSocketProtocol" title="enum GSocketProtocol"><span class="type">GSocketProtocol</span></a>       : Read / Write / Construct Only
228   "<a class="link" href="GSocket.html#GSocket--remote-address" title='The "remote-address" property'>remote-address</a>"           <a class="link" href="GSocketAddress.html" title="GSocketAddress"><span class="type">GSocketAddress</span></a>*       : Read
229   "<a class="link" href="GSocket.html#GSocket--timeout" title='The "timeout" property'>timeout</a>"                  <a href="./../glib/glib/glib-Basic-Types.html#guint"><span class="type">guint</span></a>                 : Read / Write
230   "<a class="link" href="GSocket.html#GSocket--ttl" title='The "ttl" property'>ttl</a>"                      <a href="./../glib/glib/glib-Basic-Types.html#guint"><span class="type">guint</span></a>                 : Read / Write
231   "<a class="link" href="GSocket.html#GSocket--type" title='The "type" property'>type</a>"                     <a class="link" href="GSocket.html#GSocketType" title="enum GSocketType"><span class="type">GSocketType</span></a>           : Read / Write / Construct Only
232 </pre>
233 </div>
234 <div class="refsect1">
235 <a name="GSocket.description"></a><h2>Description</h2>
236 <p>
237 A <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> is a low-level networking primitive. It is a more or less
238 direct mapping of the BSD socket API in a portable GObject based API.
239 It supports both the UNIX socket implementations and winsock2 on Windows.
240 </p>
241 <p>
242 <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> is the platform independent base upon which the higher level
243 network primitives are based. Applications are not typically meant to
244 use it directly, but rather through classes like <a class="link" href="GSocketClient.html" title="GSocketClient"><span class="type">GSocketClient</span></a>,
245 <a class="link" href="GSocketService.html" title="GSocketService"><span class="type">GSocketService</span></a> and <a class="link" href="GSocketConnection.html" title="GSocketConnection"><span class="type">GSocketConnection</span></a>. However there may be cases where
246 direct use of <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> is useful.
247 </p>
248 <p>
249 <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> implements the <a class="link" href="GInitable.html" title="GInitable"><span class="type">GInitable</span></a> interface, so if it is manually constructed
250 by e.g. <a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#g-object-new"><code class="function">g_object_new()</code></a> you must call <a class="link" href="GInitable.html#g-initable-init" title="g_initable_init ()"><code class="function">g_initable_init()</code></a> and check the
251 results before using the object. This is done automatically in
252 <a class="link" href="GSocket.html#g-socket-new" title="g_socket_new ()"><code class="function">g_socket_new()</code></a> and <a class="link" href="GSocket.html#g-socket-new-from-fd" title="g_socket_new_from_fd ()"><code class="function">g_socket_new_from_fd()</code></a>, so these functions can return
253 <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.
254 </p>
255 <p>
256 Sockets operate in two general modes, blocking or non-blocking. When
257 in blocking mode all operations block until the requested operation
258 is finished or there is an error. In non-blocking mode all calls that
259 would block return immediately with a <a class="link" href="gio-GIOError.html#G-IO-ERROR-WOULD-BLOCK:CAPS"><code class="literal">G_IO_ERROR_WOULD_BLOCK</code></a> error.
260 To know when a call would successfully run you can call <a class="link" href="GSocket.html#g-socket-condition-check" title="g_socket_condition_check ()"><code class="function">g_socket_condition_check()</code></a>,
261 or <a class="link" href="GSocket.html#g-socket-condition-wait" title="g_socket_condition_wait ()"><code class="function">g_socket_condition_wait()</code></a>. You can also use <a class="link" href="GSocket.html#g-socket-create-source" title="g_socket_create_source ()"><code class="function">g_socket_create_source()</code></a> and
262 attach it to a <a href="./../glib/glib/glib-The-Main-Event-Loop.html#GMainContext"><span class="type">GMainContext</span></a> to get callbacks when I/O is possible.
263 Note that all sockets are always set to non blocking mode in the system, and
264 blocking mode is emulated in GSocket.
265 </p>
266 <p>
267 When working in non-blocking mode applications should always be able to
268 handle getting a <a class="link" href="gio-GIOError.html#G-IO-ERROR-WOULD-BLOCK:CAPS"><code class="literal">G_IO_ERROR_WOULD_BLOCK</code></a> error even when some other
269 function said that I/O was possible. This can easily happen in case
270 of a race condition in the application, but it can also happen for other
271 reasons. For instance, on Windows a socket is always seen as writable
272 until a write returns <a class="link" href="gio-GIOError.html#G-IO-ERROR-WOULD-BLOCK:CAPS"><code class="literal">G_IO_ERROR_WOULD_BLOCK</code></a>.
273 </p>
274 <p>
275 <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>s can be either connection oriented or datagram based.
276 For connection oriented types you must first establish a connection by
277 either connecting to an address or accepting a connection from another
278 address. For connectionless socket types the target/source address is
279 specified or received in each I/O operation.
280 </p>
281 <p>
282 All socket file descriptors are set to be close-on-exec.
283 </p>
284 <p>
285 Note that creating a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> causes the signal <code class="literal">SIGPIPE</code> to be
286 ignored for the remainder of the program. If you are writing a
287 command-line utility that uses <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>, you may need to take into
288 account the fact that your program will not automatically be killed
289 if it tries to write to <code class="literal">stdout</code> after it has been closed.
290 </p>
291 </div>
292 <div class="refsect1">
293 <a name="GSocket.details"></a><h2>Details</h2>
294 <div class="refsect2">
295 <a name="GSocket-struct"></a><h3>GSocket</h3>
296 <pre class="programlisting">typedef struct _GSocket GSocket;</pre>
297 <p>
298 A lowlevel network socket object.
299 </p>
300 <p class="since">Since 2.22</p>
301 </div>
302 <hr>
303 <div class="refsect2">
304 <a name="GSocketSourceFunc"></a><h3>GSocketSourceFunc ()</h3>
305 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            (*GSocketSourceFunc)                (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
306                                                          <em class="parameter"><code><a href="./../glib/glib/glib-IO-Channels.html#GIOCondition"><span class="type">GIOCondition</span></a> condition</code></em>,
307                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
308 <p>
309 This is the function type of the callback used for the <a href="./../glib/glib/glib-The-Main-Event-Loop.html#GSource"><span class="type">GSource</span></a>
310 returned by <a class="link" href="GSocket.html#g-socket-create-source" title="g_socket_create_source ()"><code class="function">g_socket_create_source()</code></a>.
311 </p>
312 <div class="variablelist"><table border="0">
313 <col align="left" valign="top">
314 <tbody>
315 <tr>
316 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
317 <td>the <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>
318 </td>
319 </tr>
320 <tr>
321 <td><p><span class="term"><em class="parameter"><code>condition</code></em> :</span></p></td>
322 <td>the current condition at the source fired.</td>
323 </tr>
324 <tr>
325 <td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
326 <td>data passed in by the user.</td>
327 </tr>
328 <tr>
329 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
330 <td>it should return <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if the source should be removed.</td>
331 </tr>
332 </tbody>
333 </table></div>
334 <p class="since">Since 2.22</p>
335 </div>
336 <hr>
337 <div class="refsect2">
338 <a name="GSocketType"></a><h3>enum GSocketType</h3>
339 <pre class="programlisting">typedef enum {
340   G_SOCKET_TYPE_INVALID,
341   G_SOCKET_TYPE_STREAM,
342   G_SOCKET_TYPE_DATAGRAM,
343   G_SOCKET_TYPE_SEQPACKET
344 } GSocketType;
345 </pre>
346 <p>
347 Flags used when creating a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>. Some protocols may not implement
348 all the socket types.
349 </p>
350 <div class="variablelist"><table border="0">
351 <col align="left" valign="top">
352 <tbody>
353 <tr>
354 <td><p><a name="G-SOCKET-TYPE-INVALID:CAPS"></a><span class="term"><code class="literal">G_SOCKET_TYPE_INVALID</code></span></p></td>
355 <td>Type unknown or wrong
356 </td>
357 </tr>
358 <tr>
359 <td><p><a name="G-SOCKET-TYPE-STREAM:CAPS"></a><span class="term"><code class="literal">G_SOCKET_TYPE_STREAM</code></span></p></td>
360 <td>Reliable connection-based byte streams (e.g. TCP).
361 </td>
362 </tr>
363 <tr>
364 <td><p><a name="G-SOCKET-TYPE-DATAGRAM:CAPS"></a><span class="term"><code class="literal">G_SOCKET_TYPE_DATAGRAM</code></span></p></td>
365 <td>Connectionless, unreliable datagram passing.
366     (e.g. UDP)
367 </td>
368 </tr>
369 <tr>
370 <td><p><a name="G-SOCKET-TYPE-SEQPACKET:CAPS"></a><span class="term"><code class="literal">G_SOCKET_TYPE_SEQPACKET</code></span></p></td>
371 <td>Reliable connection-based passing of datagrams
372     of fixed maximum length (e.g. SCTP).
373 </td>
374 </tr>
375 </tbody>
376 </table></div>
377 <p class="since">Since 2.22</p>
378 </div>
379 <hr>
380 <div class="refsect2">
381 <a name="GSocketProtocol"></a><h3>enum GSocketProtocol</h3>
382 <pre class="programlisting">typedef enum {
383   G_SOCKET_PROTOCOL_UNKNOWN = -1,
384   G_SOCKET_PROTOCOL_DEFAULT = 0,
385   G_SOCKET_PROTOCOL_TCP     = 6,
386   G_SOCKET_PROTOCOL_UDP     = 17,
387   G_SOCKET_PROTOCOL_SCTP    = 132
388 } GSocketProtocol;
389 </pre>
390 <p>
391 A protocol identifier is specified when creating a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>, which is a
392 family/type specific identifier, where 0 means the default protocol for
393 the particular family/type.
394 </p>
395 <p>
396 This enum contains a set of commonly available and used protocols. You
397 can also pass any other identifiers handled by the platform in order to
398 use protocols not listed here.
399 </p>
400 <div class="variablelist"><table border="0">
401 <col align="left" valign="top">
402 <tbody>
403 <tr>
404 <td><p><a name="G-SOCKET-PROTOCOL-UNKNOWN:CAPS"></a><span class="term"><code class="literal">G_SOCKET_PROTOCOL_UNKNOWN</code></span></p></td>
405 <td>The protocol type is unknown
406 </td>
407 </tr>
408 <tr>
409 <td><p><a name="G-SOCKET-PROTOCOL-DEFAULT:CAPS"></a><span class="term"><code class="literal">G_SOCKET_PROTOCOL_DEFAULT</code></span></p></td>
410 <td>The default protocol for the family/type
411 </td>
412 </tr>
413 <tr>
414 <td><p><a name="G-SOCKET-PROTOCOL-TCP:CAPS"></a><span class="term"><code class="literal">G_SOCKET_PROTOCOL_TCP</code></span></p></td>
415 <td>TCP over IP
416 </td>
417 </tr>
418 <tr>
419 <td><p><a name="G-SOCKET-PROTOCOL-UDP:CAPS"></a><span class="term"><code class="literal">G_SOCKET_PROTOCOL_UDP</code></span></p></td>
420 <td>UDP over IP
421 </td>
422 </tr>
423 <tr>
424 <td><p><a name="G-SOCKET-PROTOCOL-SCTP:CAPS"></a><span class="term"><code class="literal">G_SOCKET_PROTOCOL_SCTP</code></span></p></td>
425 <td>SCTP over IP
426 </td>
427 </tr>
428 </tbody>
429 </table></div>
430 <p class="since">Since 2.22</p>
431 </div>
432 <hr>
433 <div class="refsect2">
434 <a name="GSocketMsgFlags"></a><h3>enum GSocketMsgFlags</h3>
435 <pre class="programlisting">typedef enum {
436   G_SOCKET_MSG_NONE,
437   G_SOCKET_MSG_OOB = GLIB_SYSDEF_MSG_OOB,
438   G_SOCKET_MSG_PEEK = GLIB_SYSDEF_MSG_PEEK,
439   G_SOCKET_MSG_DONTROUTE = GLIB_SYSDEF_MSG_DONTROUTE
440 } GSocketMsgFlags;
441 </pre>
442 <p>
443 Flags used in <a class="link" href="GSocket.html#g-socket-receive-message" title="g_socket_receive_message ()"><code class="function">g_socket_receive_message()</code></a> and <a class="link" href="GSocket.html#g-socket-send-message" title="g_socket_send_message ()"><code class="function">g_socket_send_message()</code></a>.
444 The flags listed in the enum are some commonly available flags, but the
445 values used for them are the same as on the platform, and any other flags
446 are passed in/out as is. So to use a platform specific flag, just include
447 the right system header and pass in the flag.
448 </p>
449 <div class="variablelist"><table border="0">
450 <col align="left" valign="top">
451 <tbody>
452 <tr>
453 <td><p><a name="G-SOCKET-MSG-NONE:CAPS"></a><span class="term"><code class="literal">G_SOCKET_MSG_NONE</code></span></p></td>
454 <td>No flags.
455 </td>
456 </tr>
457 <tr>
458 <td><p><a name="G-SOCKET-MSG-OOB:CAPS"></a><span class="term"><code class="literal">G_SOCKET_MSG_OOB</code></span></p></td>
459 <td>Request to send/receive out of band data.
460 </td>
461 </tr>
462 <tr>
463 <td><p><a name="G-SOCKET-MSG-PEEK:CAPS"></a><span class="term"><code class="literal">G_SOCKET_MSG_PEEK</code></span></p></td>
464 <td>Read data from the socket without removing it from
465     the queue.
466 </td>
467 </tr>
468 <tr>
469 <td><p><a name="G-SOCKET-MSG-DONTROUTE:CAPS"></a><span class="term"><code class="literal">G_SOCKET_MSG_DONTROUTE</code></span></p></td>
470 <td>Don't use a gateway to send out the packet,
471     only send to hosts on directly connected networks.
472 </td>
473 </tr>
474 </tbody>
475 </table></div>
476 <p class="since">Since 2.22</p>
477 </div>
478 <hr>
479 <div class="refsect2">
480 <a name="GInputVector"></a><h3>struct GInputVector</h3>
481 <pre class="programlisting">struct GInputVector {
482   gpointer buffer;
483   gsize size;
484 };
485 </pre>
486 <p>
487 Structure used for scatter/gather data input.
488 You generally pass in an array of <a class="link" href="GSocket.html#GInputVector" title="struct GInputVector"><span class="type">GInputVector</span></a>s
489 and the operation will store the read data starting in the
490 first buffer, switching to the next as needed.
491 </p>
492 <div class="variablelist"><table border="0">
493 <col align="left" valign="top">
494 <tbody>
495 <tr>
496 <td><p><span class="term"><a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> <em class="structfield"><code><a name="GInputVector.buffer"></a>buffer</code></em>;</span></p></td>
497 <td>Pointer to a buffer where data will be written.</td>
498 </tr>
499 <tr>
500 <td><p><span class="term"><a href="./../glib/glib/glib-Basic-Types.html#gsize"><span class="type">gsize</span></a> <em class="structfield"><code><a name="GInputVector.size"></a>size</code></em>;</span></p></td>
501 <td>the available size in <em class="parameter"><code>buffer</code></em>.</td>
502 </tr>
503 </tbody>
504 </table></div>
505 <p class="since">Since 2.22</p>
506 </div>
507 <hr>
508 <div class="refsect2">
509 <a name="GOutputVector"></a><h3>struct GOutputVector</h3>
510 <pre class="programlisting">struct GOutputVector {
511   gconstpointer buffer;
512   gsize size;
513 };
514 </pre>
515 <p>
516 Structure used for scatter/gather data output.
517 You generally pass in an array of <a class="link" href="GSocket.html#GOutputVector" title="struct GOutputVector"><span class="type">GOutputVector</span></a>s
518 and the operation will use all the buffers as if they were
519 one buffer.
520 </p>
521 <div class="variablelist"><table border="0">
522 <col align="left" valign="top">
523 <tbody>
524 <tr>
525 <td><p><span class="term"><a href="./../glib/glib/glib-Basic-Types.html#gconstpointer"><span class="type">gconstpointer</span></a> <em class="structfield"><code><a name="GOutputVector.buffer"></a>buffer</code></em>;</span></p></td>
526 <td>Pointer to a buffer of data to read.</td>
527 </tr>
528 <tr>
529 <td><p><span class="term"><a href="./../glib/glib/glib-Basic-Types.html#gsize"><span class="type">gsize</span></a> <em class="structfield"><code><a name="GOutputVector.size"></a>size</code></em>;</span></p></td>
530 <td>the size of <em class="parameter"><code>buffer</code></em>.</td>
531 </tr>
532 </tbody>
533 </table></div>
534 <p class="since">Since 2.22</p>
535 </div>
536 <hr>
537 <div class="refsect2">
538 <a name="g-socket-new"></a><h3>g_socket_new ()</h3>
539 <pre class="programlisting"><a class="link" href="GSocket.html" title="GSocket"><span class="returnvalue">GSocket</span></a> *           g_socket_new                        (<em class="parameter"><code><a class="link" href="GSocketAddress.html#GSocketFamily" title="enum GSocketFamily"><span class="type">GSocketFamily</span></a> family</code></em>,
540                                                          <em class="parameter"><code><a class="link" href="GSocket.html#GSocketType" title="enum GSocketType"><span class="type">GSocketType</span></a> type</code></em>,
541                                                          <em class="parameter"><code><a class="link" href="GSocket.html#GSocketProtocol" title="enum GSocketProtocol"><span class="type">GSocketProtocol</span></a> protocol</code></em>,
542                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
543 <p>
544 Creates a new <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> with the defined family, type and protocol.
545 If <em class="parameter"><code>protocol</code></em> is 0 (<a class="link" href="GSocket.html#G-SOCKET-PROTOCOL-DEFAULT:CAPS"><code class="literal">G_SOCKET_PROTOCOL_DEFAULT</code></a>) the default protocol type
546 for the family and type is used.
547 </p>
548 <p>
549 The <em class="parameter"><code>protocol</code></em> is a family and type specific int that specifies what
550 kind of protocol to use. <a class="link" href="GSocket.html#GSocketProtocol" title="enum GSocketProtocol"><span class="type">GSocketProtocol</span></a> lists several common ones.
551 Many families only support one protocol, and use 0 for this, others
552 support several and using 0 means to use the default protocol for
553 the family and type.
554 </p>
555 <p>
556 The protocol id is passed directly to the operating
557 system, so you can use protocols not listed in <a class="link" href="GSocket.html#GSocketProtocol" title="enum GSocketProtocol"><span class="type">GSocketProtocol</span></a> if you
558 know the protocol number used for it.
559 </p>
560 <div class="variablelist"><table border="0">
561 <col align="left" valign="top">
562 <tbody>
563 <tr>
564 <td><p><span class="term"><em class="parameter"><code>family</code></em> :</span></p></td>
565 <td>the socket family to use, e.g. <a class="link" href="GSocketAddress.html#G-SOCKET-FAMILY-IPV4:CAPS"><code class="literal">G_SOCKET_FAMILY_IPV4</code></a>.</td>
566 </tr>
567 <tr>
568 <td><p><span class="term"><em class="parameter"><code>type</code></em> :</span></p></td>
569 <td>the socket type to use.</td>
570 </tr>
571 <tr>
572 <td><p><span class="term"><em class="parameter"><code>protocol</code></em> :</span></p></td>
573 <td>the id of the protocol to use, or 0 for default.</td>
574 </tr>
575 <tr>
576 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
577 <td>
578 <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> for error reporting, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore.</td>
579 </tr>
580 <tr>
581 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
582 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on error.
583 Free the returned object with <a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#g-object-unref"><code class="function">g_object_unref()</code></a>.</td>
584 </tr>
585 </tbody>
586 </table></div>
587 <p class="since">Since 2.22</p>
588 </div>
589 <hr>
590 <div class="refsect2">
591 <a name="g-socket-new-from-fd"></a><h3>g_socket_new_from_fd ()</h3>
592 <pre class="programlisting"><a class="link" href="GSocket.html" title="GSocket"><span class="returnvalue">GSocket</span></a> *           g_socket_new_from_fd                (<em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> fd</code></em>,
593                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
594 <p>
595 Creates a new <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> from a native file descriptor
596 or winsock SOCKET handle.
597 </p>
598 <p>
599 This reads all the settings from the file descriptor so that
600 all properties should work. Note that the file descriptor
601 will be set to non-blocking mode, independent on the blocking
602 mode of the <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>.
603 </p>
604 <div class="variablelist"><table border="0">
605 <col align="left" valign="top">
606 <tbody>
607 <tr>
608 <td><p><span class="term"><em class="parameter"><code>fd</code></em> :</span></p></td>
609 <td>a native socket file descriptor.</td>
610 </tr>
611 <tr>
612 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
613 <td>
614 <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> for error reporting, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore.</td>
615 </tr>
616 <tr>
617 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
618 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on error.
619 Free the returned object with <a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#g-object-unref"><code class="function">g_object_unref()</code></a>.</td>
620 </tr>
621 </tbody>
622 </table></div>
623 <p class="since">Since 2.22</p>
624 </div>
625 <hr>
626 <div class="refsect2">
627 <a name="g-socket-bind"></a><h3>g_socket_bind ()</h3>
628 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            g_socket_bind                       (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
629                                                          <em class="parameter"><code><a class="link" href="GSocketAddress.html" title="GSocketAddress"><span class="type">GSocketAddress</span></a> *address</code></em>,
630                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> allow_reuse</code></em>,
631                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
632 <p>
633 When a socket is created it is attached to an address family, but it
634 doesn't have an address in this family. <a class="link" href="GSocket.html#g-socket-bind" title="g_socket_bind ()"><code class="function">g_socket_bind()</code></a> assigns the
635 address (sometimes called name) of the socket.
636 </p>
637 <p>
638 It is generally required to bind to a local address before you can
639 receive connections. (See <a class="link" href="GSocket.html#g-socket-listen" title="g_socket_listen ()"><code class="function">g_socket_listen()</code></a> and <a class="link" href="GSocket.html#g-socket-accept" title="g_socket_accept ()"><code class="function">g_socket_accept()</code></a> ).
640 In certain situations, you may also want to bind a socket that will be
641 used to initiate connections, though this is not normally required.
642 </p>
643 <p>
644 <em class="parameter"><code>allow_reuse</code></em> should be <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> for server sockets (sockets that you will
645 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="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> for client sockets.
646 (Specifically, if it is <a href="./../glib/glib/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
647 <code class="literal">SO_REUSEADDR</code> flag on the socket, allowing it to bind <em class="parameter"><code>address</code></em> even if
648 that address was previously used by another socket that has not yet been
649 fully cleaned-up by the kernel. Failing to set this flag on a server
650 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
651 the server program is stopped and then immediately restarted.)
652 </p>
653 <div class="variablelist"><table border="0">
654 <col align="left" valign="top">
655 <tbody>
656 <tr>
657 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
658 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>.</td>
659 </tr>
660 <tr>
661 <td><p><span class="term"><em class="parameter"><code>address</code></em> :</span></p></td>
662 <td>a <a class="link" href="GSocketAddress.html" title="GSocketAddress"><span class="type">GSocketAddress</span></a> specifying the local address.</td>
663 </tr>
664 <tr>
665 <td><p><span class="term"><em class="parameter"><code>allow_reuse</code></em> :</span></p></td>
666 <td>whether to allow reusing this address</td>
667 </tr>
668 <tr>
669 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
670 <td>
671 <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> for error reporting, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore.</td>
672 </tr>
673 <tr>
674 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
675 <td>
676 <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> on success, <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> on error.</td>
677 </tr>
678 </tbody>
679 </table></div>
680 <p class="since">Since 2.22</p>
681 </div>
682 <hr>
683 <div class="refsect2">
684 <a name="g-socket-listen"></a><h3>g_socket_listen ()</h3>
685 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            g_socket_listen                     (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
686                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
687 <p>
688 Marks the socket as a server socket, i.e. a socket that is used
689 to accept incoming requests using <a class="link" href="GSocket.html#g-socket-accept" title="g_socket_accept ()"><code class="function">g_socket_accept()</code></a>.
690 </p>
691 <p>
692 Before calling this the socket must be bound to a local address using
693 <a class="link" href="GSocket.html#g-socket-bind" title="g_socket_bind ()"><code class="function">g_socket_bind()</code></a>.
694 </p>
695 <p>
696 To set the maximum amount of outstanding clients, use
697 <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>.
698 </p>
699 <div class="variablelist"><table border="0">
700 <col align="left" valign="top">
701 <tbody>
702 <tr>
703 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
704 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>.</td>
705 </tr>
706 <tr>
707 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
708 <td>
709 <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> for error reporting, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore.</td>
710 </tr>
711 <tr>
712 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
713 <td>
714 <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> on success, <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> on error.</td>
715 </tr>
716 </tbody>
717 </table></div>
718 <p class="since">Since 2.22</p>
719 </div>
720 <hr>
721 <div class="refsect2">
722 <a name="g-socket-accept"></a><h3>g_socket_accept ()</h3>
723 <pre class="programlisting"><a class="link" href="GSocket.html" title="GSocket"><span class="returnvalue">GSocket</span></a> *           g_socket_accept                     (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
724                                                          <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
725                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
726 <p>
727 Accept incoming connections on a connection-based socket. This removes
728 the first outstanding connection request from the listening socket and
729 creates a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> object for it.
730 </p>
731 <p>
732 The <em class="parameter"><code>socket</code></em> must be bound to a local address with <a class="link" href="GSocket.html#g-socket-bind" title="g_socket_bind ()"><code class="function">g_socket_bind()</code></a> and
733 must be listening for incoming connections (<a class="link" href="GSocket.html#g-socket-listen" title="g_socket_listen ()"><code class="function">g_socket_listen()</code></a>).
734 </p>
735 <p>
736 If there are no outstanding connections then the operation will block
737 or return <a class="link" href="gio-GIOError.html#G-IO-ERROR-WOULD-BLOCK:CAPS"><code class="literal">G_IO_ERROR_WOULD_BLOCK</code></a> if non-blocking I/O is enabled.
738 To be notified of an incoming connection, wait for the <a href="./../glib/glib/glib-IO-Channels.html#G-IO-IN:CAPS"><code class="literal">G_IO_IN</code></a> condition.
739 </p>
740 <div class="variablelist"><table border="0">
741 <col align="left" valign="top">
742 <tbody>
743 <tr>
744 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
745 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>.</td>
746 </tr>
747 <tr>
748 <td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
749 <td>a <a class="link" href="GCancellable.html" title="GCancellable"><code class="literal">GCancellable</code></a> or <a href="./../glib/glib/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>
750 </td>
751 </tr>
752 <tr>
753 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
754 <td>
755 <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> for error reporting, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore.</td>
756 </tr>
757 <tr>
758 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
759 <td>a new <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on error.
760 Free the returned object with <a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#g-object-unref"><code class="function">g_object_unref()</code></a>. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
761 </td>
762 </tr>
763 </tbody>
764 </table></div>
765 <p class="since">Since 2.22</p>
766 </div>
767 <hr>
768 <div class="refsect2">
769 <a name="g-socket-connect"></a><h3>g_socket_connect ()</h3>
770 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            g_socket_connect                    (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
771                                                          <em class="parameter"><code><a class="link" href="GSocketAddress.html" title="GSocketAddress"><span class="type">GSocketAddress</span></a> *address</code></em>,
772                                                          <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
773                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
774 <p>
775 Connect the socket to the specified remote address.
776 </p>
777 <p>
778 For connection oriented socket this generally means we attempt to make
779 a connection to the <em class="parameter"><code>address</code></em>. For a connection-less socket it sets
780 the default address for <a class="link" href="GSocket.html#g-socket-send" title="g_socket_send ()"><code class="function">g_socket_send()</code></a> and discards all incoming datagrams
781 from other sources.
782 </p>
783 <p>
784 Generally connection oriented sockets can only connect once, but
785 connection-less sockets can connect multiple times to change the
786 default address.
787 </p>
788 <p>
789 If the connect call needs to do network I/O it will block, unless
790 non-blocking I/O is enabled. Then <a class="link" href="gio-GIOError.html#G-IO-ERROR-PENDING:CAPS"><code class="literal">G_IO_ERROR_PENDING</code></a> is returned
791 and the user can be notified of the connection finishing by waiting
792 for the G_IO_OUT condition. The result of the connection must then be
793 checked with <a class="link" href="GSocket.html#g-socket-check-connect-result" title="g_socket_check_connect_result ()"><code class="function">g_socket_check_connect_result()</code></a>.
794 </p>
795 <div class="variablelist"><table border="0">
796 <col align="left" valign="top">
797 <tbody>
798 <tr>
799 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
800 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>.</td>
801 </tr>
802 <tr>
803 <td><p><span class="term"><em class="parameter"><code>address</code></em> :</span></p></td>
804 <td>a <a class="link" href="GSocketAddress.html" title="GSocketAddress"><span class="type">GSocketAddress</span></a> specifying the remote address.</td>
805 </tr>
806 <tr>
807 <td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
808 <td>a <a class="link" href="GCancellable.html" title="GCancellable"><code class="literal">GCancellable</code></a> or <a href="./../glib/glib/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>
809 </td>
810 </tr>
811 <tr>
812 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
813 <td>
814 <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> for error reporting, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore.</td>
815 </tr>
816 <tr>
817 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
818 <td>
819 <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if connected, <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> on error.</td>
820 </tr>
821 </tbody>
822 </table></div>
823 <p class="since">Since 2.22</p>
824 </div>
825 <hr>
826 <div class="refsect2">
827 <a name="g-socket-check-connect-result"></a><h3>g_socket_check_connect_result ()</h3>
828 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            g_socket_check_connect_result       (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
829                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
830 <p>
831 Checks and resets the pending connect error for the socket.
832 This is used to check for errors when <a class="link" href="GSocket.html#g-socket-connect" title="g_socket_connect ()"><code class="function">g_socket_connect()</code></a> is
833 used in non-blocking mode.
834 </p>
835 <div class="variablelist"><table border="0">
836 <col align="left" valign="top">
837 <tbody>
838 <tr>
839 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
840 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>
841 </td>
842 </tr>
843 <tr>
844 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
845 <td>
846 <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> for error reporting, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore.</td>
847 </tr>
848 <tr>
849 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
850 <td>
851 <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if no error, <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise, setting <em class="parameter"><code>error</code></em> to the error</td>
852 </tr>
853 </tbody>
854 </table></div>
855 <p class="since">Since 2.22</p>
856 </div>
857 <hr>
858 <div class="refsect2">
859 <a name="g-socket-receive"></a><h3>g_socket_receive ()</h3>
860 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gssize"><span class="returnvalue">gssize</span></a>              g_socket_receive                    (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
861                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *buffer</code></em>,
862                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gsize"><span class="type">gsize</span></a> size</code></em>,
863                                                          <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
864                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
865 <p>
866 Receive data (up to <em class="parameter"><code>size</code></em> bytes) from a socket. This is mainly used by
867 connection-oriented sockets; it is identical to <a class="link" href="GSocket.html#g-socket-receive-from" title="g_socket_receive_from ()"><code class="function">g_socket_receive_from()</code></a>
868 with <em class="parameter"><code>address</code></em> set to <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.
869 </p>
870 <p>
871 For <a class="link" href="GSocket.html#G-SOCKET-TYPE-DATAGRAM:CAPS"><code class="literal">G_SOCKET_TYPE_DATAGRAM</code></a> and <a class="link" href="GSocket.html#G-SOCKET-TYPE-SEQPACKET:CAPS"><code class="literal">G_SOCKET_TYPE_SEQPACKET</code></a> sockets,
872 <a class="link" href="GSocket.html#g-socket-receive" title="g_socket_receive ()"><code class="function">g_socket_receive()</code></a> will always read either 0 or 1 complete messages from
873 the socket. If the received message is too large to fit in <em class="parameter"><code>buffer</code></em>, then
874 the data beyond <em class="parameter"><code>size</code></em> bytes will be discarded, without any explicit
875 indication that this has occurred.
876 </p>
877 <p>
878 For <a class="link" href="GSocket.html#G-SOCKET-TYPE-STREAM:CAPS"><code class="literal">G_SOCKET_TYPE_STREAM</code></a> sockets, <a class="link" href="GSocket.html#g-socket-receive" title="g_socket_receive ()"><code class="function">g_socket_receive()</code></a> can return any
879 number of bytes, up to <em class="parameter"><code>size</code></em>. If more than <em class="parameter"><code>size</code></em> bytes have been
880 received, the additional data will be returned in future calls to
881 <a class="link" href="GSocket.html#g-socket-receive" title="g_socket_receive ()"><code class="function">g_socket_receive()</code></a>.
882 </p>
883 <p>
884 If the socket is in blocking mode the call will block until there
885 is some data to receive, the connection is closed, or there is an
886 error. If there is no data available and the socket is in
887 non-blocking mode, a <a class="link" href="gio-GIOError.html#G-IO-ERROR-WOULD-BLOCK:CAPS"><code class="literal">G_IO_ERROR_WOULD_BLOCK</code></a> error will be
888 returned. To be notified when data is available, wait for the
889 <a href="./../glib/glib/glib-IO-Channels.html#G-IO-IN:CAPS"><code class="literal">G_IO_IN</code></a> condition.
890 </p>
891 <p>
892 On error -1 is returned and <em class="parameter"><code>error</code></em> is set accordingly.
893 </p>
894 <div class="variablelist"><table border="0">
895 <col align="left" valign="top">
896 <tbody>
897 <tr>
898 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
899 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>
900 </td>
901 </tr>
902 <tr>
903 <td><p><span class="term"><em class="parameter"><code>buffer</code></em> :</span></p></td>
904 <td>a buffer to read data into (which should be at least <em class="parameter"><code>size</code></em>
905 bytes long).</td>
906 </tr>
907 <tr>
908 <td><p><span class="term"><em class="parameter"><code>size</code></em> :</span></p></td>
909 <td>the number of bytes you want to read from the socket</td>
910 </tr>
911 <tr>
912 <td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
913 <td>a <a class="link" href="GCancellable.html" title="GCancellable"><code class="literal">GCancellable</code></a> or <a href="./../glib/glib/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>
914 </td>
915 </tr>
916 <tr>
917 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
918 <td>
919 <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> for error reporting, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore.</td>
920 </tr>
921 <tr>
922 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
923 <td>Number of bytes read, or 0 if the connection was closed by
924 the peer, or -1 on error</td>
925 </tr>
926 </tbody>
927 </table></div>
928 <p class="since">Since 2.22</p>
929 </div>
930 <hr>
931 <div class="refsect2">
932 <a name="g-socket-receive-from"></a><h3>g_socket_receive_from ()</h3>
933 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gssize"><span class="returnvalue">gssize</span></a>              g_socket_receive_from               (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
934                                                          <em class="parameter"><code><a class="link" href="GSocketAddress.html" title="GSocketAddress"><span class="type">GSocketAddress</span></a> **address</code></em>,
935                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *buffer</code></em>,
936                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gsize"><span class="type">gsize</span></a> size</code></em>,
937                                                          <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
938                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
939 <p>
940 Receive data (up to <em class="parameter"><code>size</code></em> bytes) from a socket.
941 </p>
942 <p>
943 If <em class="parameter"><code>address</code></em> is non-<a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> then <em class="parameter"><code>address</code></em> will be set equal to the
944 source address of the received packet.
945 <em class="parameter"><code>address</code></em> is owned by the caller.
946 </p>
947 <p>
948 See <a class="link" href="GSocket.html#g-socket-receive" title="g_socket_receive ()"><code class="function">g_socket_receive()</code></a> for additional information.
949 </p>
950 <div class="variablelist"><table border="0">
951 <col align="left" valign="top">
952 <tbody>
953 <tr>
954 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
955 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>
956 </td>
957 </tr>
958 <tr>
959 <td><p><span class="term"><em class="parameter"><code>address</code></em> :</span></p></td>
960 <td>a pointer to a <a class="link" href="GSocketAddress.html" title="GSocketAddress"><span class="type">GSocketAddress</span></a>
961 pointer, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <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>
962 </td>
963 </tr>
964 <tr>
965 <td><p><span class="term"><em class="parameter"><code>buffer</code></em> :</span></p></td>
966 <td>a buffer to
967 read data into (which should be at least <em class="parameter"><code>size</code></em> bytes long). <span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=size][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> guint8]</span>
968 </td>
969 </tr>
970 <tr>
971 <td><p><span class="term"><em class="parameter"><code>size</code></em> :</span></p></td>
972 <td>the number of bytes you want to read from the socket</td>
973 </tr>
974 <tr>
975 <td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
976 <td>a <a class="link" href="GCancellable.html" title="GCancellable"><code class="literal">GCancellable</code></a> or <a href="./../glib/glib/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>
977 </td>
978 </tr>
979 <tr>
980 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
981 <td>
982 <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> for error reporting, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore.</td>
983 </tr>
984 <tr>
985 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
986 <td>Number of bytes read, or 0 if the connection was closed by
987 the peer, or -1 on error</td>
988 </tr>
989 </tbody>
990 </table></div>
991 <p class="since">Since 2.22</p>
992 </div>
993 <hr>
994 <div class="refsect2">
995 <a name="g-socket-receive-message"></a><h3>g_socket_receive_message ()</h3>
996 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gssize"><span class="returnvalue">gssize</span></a>              g_socket_receive_message            (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
997                                                          <em class="parameter"><code><a class="link" href="GSocketAddress.html" title="GSocketAddress"><span class="type">GSocketAddress</span></a> **address</code></em>,
998                                                          <em class="parameter"><code><a class="link" href="GSocket.html#GInputVector" title="struct GInputVector"><span class="type">GInputVector</span></a> *vectors</code></em>,
999                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> num_vectors</code></em>,
1000                                                          <em class="parameter"><code><a class="link" href="GSocketControlMessage.html" title="GSocketControlMessage"><span class="type">GSocketControlMessage</span></a> ***messages</code></em>,
1001                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> *num_messages</code></em>,
1002                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> *flags</code></em>,
1003                                                          <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
1004                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
1005 <p>
1006 Receive data from a socket.  This is the most complicated and
1007 fully-featured version of this call. For easier use, see
1008 <a class="link" href="GSocket.html#g-socket-receive" title="g_socket_receive ()"><code class="function">g_socket_receive()</code></a> and <a class="link" href="GSocket.html#g-socket-receive-from" title="g_socket_receive_from ()"><code class="function">g_socket_receive_from()</code></a>.
1009 </p>
1010 <p>
1011 If <em class="parameter"><code>address</code></em> is non-<a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> then <em class="parameter"><code>address</code></em> will be set equal to the
1012 source address of the received packet.
1013 <em class="parameter"><code>address</code></em> is owned by the caller.
1014 </p>
1015 <p>
1016 <em class="parameter"><code>vector</code></em> must point to an array of <a class="link" href="GSocket.html#GInputVector" title="struct GInputVector"><span class="type">GInputVector</span></a> structs and
1017 <em class="parameter"><code>num_vectors</code></em> must be the length of this array.  These structs
1018 describe the buffers that received data will be scattered into.
1019 If <em class="parameter"><code>num_vectors</code></em> is -1, then <em class="parameter"><code>vectors</code></em> is assumed to be terminated
1020 by a <a class="link" href="GSocket.html#GInputVector" title="struct GInputVector"><span class="type">GInputVector</span></a> with a <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> buffer pointer.
1021 </p>
1022 <p>
1023 As a special case, if <em class="parameter"><code>num_vectors</code></em> is 0 (in which case, <em class="parameter"><code>vectors</code></em>
1024 may of course be <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>), then a single byte is received and
1025 discarded. This is to facilitate the common practice of sending a
1026 single '\0' byte for the purposes of transferring ancillary data.
1027 </p>
1028 <p>
1029 <em class="parameter"><code>messages</code></em>, if non-<a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, will be set to point to a newly-allocated
1030 array of <a class="link" href="GSocketControlMessage.html" title="GSocketControlMessage"><span class="type">GSocketControlMessage</span></a> instances or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if no such
1031 messages was received. These correspond to the control messages
1032 received from the kernel, one <a class="link" href="GSocketControlMessage.html" title="GSocketControlMessage"><span class="type">GSocketControlMessage</span></a> per message
1033 from the kernel. This array is <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>-terminated and must be freed
1034 by the caller using <a href="./../glib/glib/glib-Memory-Allocation.html#g-free"><code class="function">g_free()</code></a> after calling <a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#g-object-unref"><code class="function">g_object_unref()</code></a> on each
1035 element. If <em class="parameter"><code>messages</code></em> is <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, any control messages received will
1036 be discarded.
1037 </p>
1038 <p>
1039 <em class="parameter"><code>num_messages</code></em>, if non-<a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, will be set to the number of control
1040 messages received.
1041 </p>
1042 <p>
1043 If both <em class="parameter"><code>messages</code></em> and <em class="parameter"><code>num_messages</code></em> are non-<a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, then
1044 <em class="parameter"><code>num_messages</code></em> gives the number of <a class="link" href="GSocketControlMessage.html" title="GSocketControlMessage"><span class="type">GSocketControlMessage</span></a> instances
1045 in <em class="parameter"><code>messages</code></em> (ie: not including the <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> terminator).
1046 </p>
1047 <p>
1048 <em class="parameter"><code>flags</code></em> is an in/out parameter. The commonly available arguments
1049 for this are available in the <a class="link" href="GSocket.html#GSocketMsgFlags" title="enum GSocketMsgFlags"><span class="type">GSocketMsgFlags</span></a> enum, but the
1050 values there are the same as the system values, and the flags
1051 are passed in as-is, so you can pass in system-specific flags too
1052 (and <a class="link" href="GSocket.html#g-socket-receive-message" title="g_socket_receive_message ()"><code class="function">g_socket_receive_message()</code></a> may pass system-specific flags out).
1053 </p>
1054 <p>
1055 As with <a class="link" href="GSocket.html#g-socket-receive" title="g_socket_receive ()"><code class="function">g_socket_receive()</code></a>, data may be discarded if <em class="parameter"><code>socket</code></em> is
1056 <a class="link" href="GSocket.html#G-SOCKET-TYPE-DATAGRAM:CAPS"><code class="literal">G_SOCKET_TYPE_DATAGRAM</code></a> or <a class="link" href="GSocket.html#G-SOCKET-TYPE-SEQPACKET:CAPS"><code class="literal">G_SOCKET_TYPE_SEQPACKET</code></a> and you do not
1057 provide enough buffer space to read a complete message. You can pass
1058 <a class="link" href="GSocket.html#G-SOCKET-MSG-PEEK:CAPS"><code class="literal">G_SOCKET_MSG_PEEK</code></a> in <em class="parameter"><code>flags</code></em> to peek at the current message without
1059 removing it from the receive queue, but there is no portable way to find
1060 out the length of the message other than by reading it into a
1061 sufficiently-large buffer.
1062 </p>
1063 <p>
1064 If the socket is in blocking mode the call will block until there
1065 is some data to receive, the connection is closed, or there is an
1066 error. If there is no data available and the socket is in
1067 non-blocking mode, a <a class="link" href="gio-GIOError.html#G-IO-ERROR-WOULD-BLOCK:CAPS"><code class="literal">G_IO_ERROR_WOULD_BLOCK</code></a> error will be
1068 returned. To be notified when data is available, wait for the
1069 <a href="./../glib/glib/glib-IO-Channels.html#G-IO-IN:CAPS"><code class="literal">G_IO_IN</code></a> condition.
1070 </p>
1071 <p>
1072 On error -1 is returned and <em class="parameter"><code>error</code></em> is set accordingly.
1073 </p>
1074 <div class="variablelist"><table border="0">
1075 <col align="left" valign="top">
1076 <tbody>
1077 <tr>
1078 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
1079 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>
1080 </td>
1081 </tr>
1082 <tr>
1083 <td><p><span class="term"><em class="parameter"><code>address</code></em> :</span></p></td>
1084 <td>a pointer to a <a class="link" href="GSocketAddress.html" title="GSocketAddress"><span class="type">GSocketAddress</span></a>
1085 pointer, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <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>
1086 </td>
1087 </tr>
1088 <tr>
1089 <td><p><span class="term"><em class="parameter"><code>vectors</code></em> :</span></p></td>
1090 <td>an array of <a class="link" href="GSocket.html#GInputVector" title="struct GInputVector"><span class="type">GInputVector</span></a> structs. <span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=num_vectors]</span>
1091 </td>
1092 </tr>
1093 <tr>
1094 <td><p><span class="term"><em class="parameter"><code>num_vectors</code></em> :</span></p></td>
1095 <td>the number of elements in <em class="parameter"><code>vectors</code></em>, or -1</td>
1096 </tr>
1097 <tr>
1098 <td><p><span class="term"><em class="parameter"><code>messages</code></em> :</span></p></td>
1099 <td>a pointer which
1100 may be filled with an array of <a href="GSocketControlMessage.html"><span class="type">GSocketControlMessages</span></a>, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=num_messages][<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
1101 </td>
1102 </tr>
1103 <tr>
1104 <td><p><span class="term"><em class="parameter"><code>num_messages</code></em> :</span></p></td>
1105 <td>a pointer which will be filled with the number of
1106 elements in <em class="parameter"><code>messages</code></em>, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
1107 </td>
1108 </tr>
1109 <tr>
1110 <td><p><span class="term"><em class="parameter"><code>flags</code></em> :</span></p></td>
1111 <td>a pointer to an int containing <a class="link" href="GSocket.html#GSocketMsgFlags" title="enum GSocketMsgFlags"><span class="type">GSocketMsgFlags</span></a> flags</td>
1112 </tr>
1113 <tr>
1114 <td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
1115 <td>a <a class="link" href="GCancellable.html" title="GCancellable"><code class="literal">GCancellable</code></a> or <a href="./../glib/glib/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>
1116 </td>
1117 </tr>
1118 <tr>
1119 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
1120 <td>a <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> pointer, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
1121 </td>
1122 </tr>
1123 <tr>
1124 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1125 <td>Number of bytes read, or 0 if the connection was closed by
1126 the peer, or -1 on error</td>
1127 </tr>
1128 </tbody>
1129 </table></div>
1130 <p class="since">Since 2.22</p>
1131 </div>
1132 <hr>
1133 <div class="refsect2">
1134 <a name="g-socket-receive-with-blocking"></a><h3>g_socket_receive_with_blocking ()</h3>
1135 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gssize"><span class="returnvalue">gssize</span></a>              g_socket_receive_with_blocking      (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
1136                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *buffer</code></em>,
1137                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gsize"><span class="type">gsize</span></a> size</code></em>,
1138                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> blocking</code></em>,
1139                                                          <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
1140                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
1141 <p>
1142 This behaves exactly the same as <a class="link" href="GSocket.html#g-socket-receive" title="g_socket_receive ()"><code class="function">g_socket_receive()</code></a>, except that
1143 the choice of blocking or non-blocking behavior is determined by
1144 the <em class="parameter"><code>blocking</code></em> argument rather than by <em class="parameter"><code>socket</code></em>'s properties.
1145 </p>
1146 <div class="variablelist"><table border="0">
1147 <col align="left" valign="top">
1148 <tbody>
1149 <tr>
1150 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
1151 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>
1152 </td>
1153 </tr>
1154 <tr>
1155 <td><p><span class="term"><em class="parameter"><code>buffer</code></em> :</span></p></td>
1156 <td>a buffer to read data into (which should be at least <em class="parameter"><code>size</code></em>
1157 bytes long).</td>
1158 </tr>
1159 <tr>
1160 <td><p><span class="term"><em class="parameter"><code>size</code></em> :</span></p></td>
1161 <td>the number of bytes you want to read from the socket</td>
1162 </tr>
1163 <tr>
1164 <td><p><span class="term"><em class="parameter"><code>blocking</code></em> :</span></p></td>
1165 <td>whether to do blocking or non-blocking I/O</td>
1166 </tr>
1167 <tr>
1168 <td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
1169 <td>a <a class="link" href="GCancellable.html" title="GCancellable"><code class="literal">GCancellable</code></a> or <a href="./../glib/glib/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>
1170 </td>
1171 </tr>
1172 <tr>
1173 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
1174 <td>
1175 <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> for error reporting, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore.</td>
1176 </tr>
1177 <tr>
1178 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1179 <td>Number of bytes read, or 0 if the connection was closed by
1180 the peer, or -1 on error</td>
1181 </tr>
1182 </tbody>
1183 </table></div>
1184 <p class="since">Since 2.26</p>
1185 </div>
1186 <hr>
1187 <div class="refsect2">
1188 <a name="g-socket-send"></a><h3>g_socket_send ()</h3>
1189 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gssize"><span class="returnvalue">gssize</span></a>              g_socket_send                       (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
1190                                                          <em class="parameter"><code>const <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *buffer</code></em>,
1191                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gsize"><span class="type">gsize</span></a> size</code></em>,
1192                                                          <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
1193                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
1194 <p>
1195 Tries to send <em class="parameter"><code>size</code></em> bytes from <em class="parameter"><code>buffer</code></em> on the socket. This is
1196 mainly used by connection-oriented sockets; it is identical to
1197 <a class="link" href="GSocket.html#g-socket-send-to" title="g_socket_send_to ()"><code class="function">g_socket_send_to()</code></a> with <em class="parameter"><code>address</code></em> set to <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.
1198 </p>
1199 <p>
1200 If the socket is in blocking mode the call will block until there is
1201 space for the data in the socket queue. If there is no space available
1202 and the socket is in non-blocking mode a <a class="link" href="gio-GIOError.html#G-IO-ERROR-WOULD-BLOCK:CAPS"><code class="literal">G_IO_ERROR_WOULD_BLOCK</code></a> error
1203 will be returned. To be notified when space is available, wait for the
1204 <a href="./../glib/glib/glib-IO-Channels.html#G-IO-OUT:CAPS"><code class="literal">G_IO_OUT</code></a> condition. Note though that you may still receive
1205 <a class="link" href="gio-GIOError.html#G-IO-ERROR-WOULD-BLOCK:CAPS"><code class="literal">G_IO_ERROR_WOULD_BLOCK</code></a> from <a class="link" href="GSocket.html#g-socket-send" title="g_socket_send ()"><code class="function">g_socket_send()</code></a> even if you were previously
1206 notified of a <a href="./../glib/glib/glib-IO-Channels.html#G-IO-OUT:CAPS"><code class="literal">G_IO_OUT</code></a> condition. (On Windows in particular, this is
1207 very common due to the way the underlying APIs work.)
1208 </p>
1209 <p>
1210 On error -1 is returned and <em class="parameter"><code>error</code></em> is set accordingly.
1211 </p>
1212 <div class="variablelist"><table border="0">
1213 <col align="left" valign="top">
1214 <tbody>
1215 <tr>
1216 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
1217 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>
1218 </td>
1219 </tr>
1220 <tr>
1221 <td><p><span class="term"><em class="parameter"><code>buffer</code></em> :</span></p></td>
1222 <td>the buffer
1223 containing the data to send. <span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=size][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> guint8]</span>
1224 </td>
1225 </tr>
1226 <tr>
1227 <td><p><span class="term"><em class="parameter"><code>size</code></em> :</span></p></td>
1228 <td>the number of bytes to send</td>
1229 </tr>
1230 <tr>
1231 <td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
1232 <td>a <a class="link" href="GCancellable.html" title="GCancellable"><code class="literal">GCancellable</code></a> or <a href="./../glib/glib/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>
1233 </td>
1234 </tr>
1235 <tr>
1236 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
1237 <td>
1238 <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> for error reporting, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore.</td>
1239 </tr>
1240 <tr>
1241 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1242 <td>Number of bytes written (which may be less than <em class="parameter"><code>size</code></em>), or -1
1243 on error</td>
1244 </tr>
1245 </tbody>
1246 </table></div>
1247 <p class="since">Since 2.22</p>
1248 </div>
1249 <hr>
1250 <div class="refsect2">
1251 <a name="g-socket-send-to"></a><h3>g_socket_send_to ()</h3>
1252 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gssize"><span class="returnvalue">gssize</span></a>              g_socket_send_to                    (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
1253                                                          <em class="parameter"><code><a class="link" href="GSocketAddress.html" title="GSocketAddress"><span class="type">GSocketAddress</span></a> *address</code></em>,
1254                                                          <em class="parameter"><code>const <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *buffer</code></em>,
1255                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gsize"><span class="type">gsize</span></a> size</code></em>,
1256                                                          <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
1257                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
1258 <p>
1259 Tries to send <em class="parameter"><code>size</code></em> bytes from <em class="parameter"><code>buffer</code></em> to <em class="parameter"><code>address</code></em>. If <em class="parameter"><code>address</code></em> is
1260 <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> then the message is sent to the default receiver (set by
1261 <a class="link" href="GSocket.html#g-socket-connect" title="g_socket_connect ()"><code class="function">g_socket_connect()</code></a>).
1262 </p>
1263 <p>
1264 See <a class="link" href="GSocket.html#g-socket-send" title="g_socket_send ()"><code class="function">g_socket_send()</code></a> for additional information.
1265 </p>
1266 <div class="variablelist"><table border="0">
1267 <col align="left" valign="top">
1268 <tbody>
1269 <tr>
1270 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
1271 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>
1272 </td>
1273 </tr>
1274 <tr>
1275 <td><p><span class="term"><em class="parameter"><code>address</code></em> :</span></p></td>
1276 <td>a <a class="link" href="GSocketAddress.html" title="GSocketAddress"><span class="type">GSocketAddress</span></a>, or <a href="./../glib/glib/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>
1277 </td>
1278 </tr>
1279 <tr>
1280 <td><p><span class="term"><em class="parameter"><code>buffer</code></em> :</span></p></td>
1281 <td>the buffer
1282 containing the data to send. <span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=size][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> guint8]</span>
1283 </td>
1284 </tr>
1285 <tr>
1286 <td><p><span class="term"><em class="parameter"><code>size</code></em> :</span></p></td>
1287 <td>the number of bytes to send</td>
1288 </tr>
1289 <tr>
1290 <td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
1291 <td>a <a class="link" href="GCancellable.html" title="GCancellable"><code class="literal">GCancellable</code></a> or <a href="./../glib/glib/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>
1292 </td>
1293 </tr>
1294 <tr>
1295 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
1296 <td>
1297 <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> for error reporting, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore.</td>
1298 </tr>
1299 <tr>
1300 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1301 <td>Number of bytes written (which may be less than <em class="parameter"><code>size</code></em>), or -1
1302 on error</td>
1303 </tr>
1304 </tbody>
1305 </table></div>
1306 <p class="since">Since 2.22</p>
1307 </div>
1308 <hr>
1309 <div class="refsect2">
1310 <a name="g-socket-send-message"></a><h3>g_socket_send_message ()</h3>
1311 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gssize"><span class="returnvalue">gssize</span></a>              g_socket_send_message               (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
1312                                                          <em class="parameter"><code><a class="link" href="GSocketAddress.html" title="GSocketAddress"><span class="type">GSocketAddress</span></a> *address</code></em>,
1313                                                          <em class="parameter"><code><a class="link" href="GSocket.html#GOutputVector" title="struct GOutputVector"><span class="type">GOutputVector</span></a> *vectors</code></em>,
1314                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> num_vectors</code></em>,
1315                                                          <em class="parameter"><code><a class="link" href="GSocketControlMessage.html" title="GSocketControlMessage"><span class="type">GSocketControlMessage</span></a> **messages</code></em>,
1316                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> num_messages</code></em>,
1317                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> flags</code></em>,
1318                                                          <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
1319                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
1320 <p>
1321 Send data to <em class="parameter"><code>address</code></em> on <em class="parameter"><code>socket</code></em>.  This is the most complicated and
1322 fully-featured version of this call. For easier use, see
1323 <a class="link" href="GSocket.html#g-socket-send" title="g_socket_send ()"><code class="function">g_socket_send()</code></a> and <a class="link" href="GSocket.html#g-socket-send-to" title="g_socket_send_to ()"><code class="function">g_socket_send_to()</code></a>.
1324 </p>
1325 <p>
1326 If <em class="parameter"><code>address</code></em> is <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> then the message is sent to the default receiver
1327 (set by <a class="link" href="GSocket.html#g-socket-connect" title="g_socket_connect ()"><code class="function">g_socket_connect()</code></a>).
1328 </p>
1329 <p>
1330 <em class="parameter"><code>vectors</code></em> must point to an array of <a class="link" href="GSocket.html#GOutputVector" title="struct GOutputVector"><span class="type">GOutputVector</span></a> structs and
1331 <em class="parameter"><code>num_vectors</code></em> must be the length of this array. (If <em class="parameter"><code>num_vectors</code></em> is -1,
1332 then <em class="parameter"><code>vectors</code></em> is assumed to be terminated by a <a class="link" href="GSocket.html#GOutputVector" title="struct GOutputVector"><span class="type">GOutputVector</span></a> with a
1333 <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> buffer pointer.) The <a class="link" href="GSocket.html#GOutputVector" title="struct GOutputVector"><span class="type">GOutputVector</span></a> structs describe the buffers
1334 that the sent data will be gathered from. Using multiple
1335 <a class="link" href="GSocket.html#GOutputVector" title="struct GOutputVector"><span class="type">GOutputVector</span></a>s is more memory-efficient than manually copying
1336 data from multiple sources into a single buffer, and more
1337 network-efficient than making multiple calls to <a class="link" href="GSocket.html#g-socket-send" title="g_socket_send ()"><code class="function">g_socket_send()</code></a>.
1338 </p>
1339 <p>
1340 <em class="parameter"><code>messages</code></em>, if non-<a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, is taken to point to an array of <em class="parameter"><code>num_messages</code></em>
1341 <a class="link" href="GSocketControlMessage.html" title="GSocketControlMessage"><span class="type">GSocketControlMessage</span></a> instances. These correspond to the control
1342 messages to be sent on the socket.
1343 If <em class="parameter"><code>num_messages</code></em> is -1 then <em class="parameter"><code>messages</code></em> is treated as a <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>-terminated
1344 array.
1345 </p>
1346 <p>
1347 <em class="parameter"><code>flags</code></em> modify how the message is sent. The commonly available arguments
1348 for this are available in the <a class="link" href="GSocket.html#GSocketMsgFlags" title="enum GSocketMsgFlags"><span class="type">GSocketMsgFlags</span></a> enum, but the
1349 values there are the same as the system values, and the flags
1350 are passed in as-is, so you can pass in system-specific flags too.
1351 </p>
1352 <p>
1353 If the socket is in blocking mode the call will block until there is
1354 space for the data in the socket queue. If there is no space available
1355 and the socket is in non-blocking mode a <a class="link" href="gio-GIOError.html#G-IO-ERROR-WOULD-BLOCK:CAPS"><code class="literal">G_IO_ERROR_WOULD_BLOCK</code></a> error
1356 will be returned. To be notified when space is available, wait for the
1357 <a href="./../glib/glib/glib-IO-Channels.html#G-IO-OUT:CAPS"><code class="literal">G_IO_OUT</code></a> condition. Note though that you may still receive
1358 <a class="link" href="gio-GIOError.html#G-IO-ERROR-WOULD-BLOCK:CAPS"><code class="literal">G_IO_ERROR_WOULD_BLOCK</code></a> from <a class="link" href="GSocket.html#g-socket-send" title="g_socket_send ()"><code class="function">g_socket_send()</code></a> even if you were previously
1359 notified of a <a href="./../glib/glib/glib-IO-Channels.html#G-IO-OUT:CAPS"><code class="literal">G_IO_OUT</code></a> condition. (On Windows in particular, this is
1360 very common due to the way the underlying APIs work.)
1361 </p>
1362 <p>
1363 On error -1 is returned and <em class="parameter"><code>error</code></em> is set accordingly.
1364 </p>
1365 <div class="variablelist"><table border="0">
1366 <col align="left" valign="top">
1367 <tbody>
1368 <tr>
1369 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
1370 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>
1371 </td>
1372 </tr>
1373 <tr>
1374 <td><p><span class="term"><em class="parameter"><code>address</code></em> :</span></p></td>
1375 <td>a <a class="link" href="GSocketAddress.html" title="GSocketAddress"><span class="type">GSocketAddress</span></a>, or <a href="./../glib/glib/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>
1376 </td>
1377 </tr>
1378 <tr>
1379 <td><p><span class="term"><em class="parameter"><code>vectors</code></em> :</span></p></td>
1380 <td>an array of <a class="link" href="GSocket.html#GOutputVector" title="struct GOutputVector"><span class="type">GOutputVector</span></a> structs. <span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=num_vectors]</span>
1381 </td>
1382 </tr>
1383 <tr>
1384 <td><p><span class="term"><em class="parameter"><code>num_vectors</code></em> :</span></p></td>
1385 <td>the number of elements in <em class="parameter"><code>vectors</code></em>, or -1</td>
1386 </tr>
1387 <tr>
1388 <td><p><span class="term"><em class="parameter"><code>messages</code></em> :</span></p></td>
1389 <td>a pointer to an
1390 array of <a href="GSocketControlMessage.html"><span class="type">GSocketControlMessages</span></a>, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=num_messages][<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
1391 </td>
1392 </tr>
1393 <tr>
1394 <td><p><span class="term"><em class="parameter"><code>num_messages</code></em> :</span></p></td>
1395 <td>number of elements in <em class="parameter"><code>messages</code></em>, or -1.</td>
1396 </tr>
1397 <tr>
1398 <td><p><span class="term"><em class="parameter"><code>flags</code></em> :</span></p></td>
1399 <td>an int containing <a class="link" href="GSocket.html#GSocketMsgFlags" title="enum GSocketMsgFlags"><span class="type">GSocketMsgFlags</span></a> flags</td>
1400 </tr>
1401 <tr>
1402 <td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
1403 <td>a <a class="link" href="GCancellable.html" title="GCancellable"><code class="literal">GCancellable</code></a> or <a href="./../glib/glib/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>
1404 </td>
1405 </tr>
1406 <tr>
1407 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
1408 <td>
1409 <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> for error reporting, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore.</td>
1410 </tr>
1411 <tr>
1412 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1413 <td>Number of bytes written (which may be less than <em class="parameter"><code>size</code></em>), or -1
1414 on error</td>
1415 </tr>
1416 </tbody>
1417 </table></div>
1418 <p class="since">Since 2.22</p>
1419 </div>
1420 <hr>
1421 <div class="refsect2">
1422 <a name="g-socket-send-with-blocking"></a><h3>g_socket_send_with_blocking ()</h3>
1423 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gssize"><span class="returnvalue">gssize</span></a>              g_socket_send_with_blocking         (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
1424                                                          <em class="parameter"><code>const <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *buffer</code></em>,
1425                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gsize"><span class="type">gsize</span></a> size</code></em>,
1426                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> blocking</code></em>,
1427                                                          <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
1428                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
1429 <p>
1430 This behaves exactly the same as <a class="link" href="GSocket.html#g-socket-send" title="g_socket_send ()"><code class="function">g_socket_send()</code></a>, except that
1431 the choice of blocking or non-blocking behavior is determined by
1432 the <em class="parameter"><code>blocking</code></em> argument rather than by <em class="parameter"><code>socket</code></em>'s properties.
1433 </p>
1434 <div class="variablelist"><table border="0">
1435 <col align="left" valign="top">
1436 <tbody>
1437 <tr>
1438 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
1439 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>
1440 </td>
1441 </tr>
1442 <tr>
1443 <td><p><span class="term"><em class="parameter"><code>buffer</code></em> :</span></p></td>
1444 <td>the buffer
1445 containing the data to send. <span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=size][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> guint8]</span>
1446 </td>
1447 </tr>
1448 <tr>
1449 <td><p><span class="term"><em class="parameter"><code>size</code></em> :</span></p></td>
1450 <td>the number of bytes to send</td>
1451 </tr>
1452 <tr>
1453 <td><p><span class="term"><em class="parameter"><code>blocking</code></em> :</span></p></td>
1454 <td>whether to do blocking or non-blocking I/O</td>
1455 </tr>
1456 <tr>
1457 <td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
1458 <td>a <a class="link" href="GCancellable.html" title="GCancellable"><code class="literal">GCancellable</code></a> or <a href="./../glib/glib/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>
1459 </td>
1460 </tr>
1461 <tr>
1462 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
1463 <td>
1464 <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> for error reporting, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore.</td>
1465 </tr>
1466 <tr>
1467 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1468 <td>Number of bytes written (which may be less than <em class="parameter"><code>size</code></em>), or -1
1469 on error</td>
1470 </tr>
1471 </tbody>
1472 </table></div>
1473 <p class="since">Since 2.26</p>
1474 </div>
1475 <hr>
1476 <div class="refsect2">
1477 <a name="g-socket-close"></a><h3>g_socket_close ()</h3>
1478 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            g_socket_close                      (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
1479                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
1480 <p>
1481 Closes the socket, shutting down any active connection.
1482 </p>
1483 <p>
1484 Closing a socket does not wait for all outstanding I/O operations
1485 to finish, so the caller should not rely on them to be guaranteed
1486 to complete even if the close returns with no error.
1487 </p>
1488 <p>
1489 Once the socket is closed, all other operations will return
1490 <a class="link" href="gio-GIOError.html#G-IO-ERROR-CLOSED:CAPS"><code class="literal">G_IO_ERROR_CLOSED</code></a>. Closing a socket multiple times will not
1491 return an error.
1492 </p>
1493 <p>
1494 Sockets will be automatically closed when the last reference
1495 is dropped, but you might want to call this function to make sure
1496 resources are released as early as possible.
1497 </p>
1498 <p>
1499 Beware that due to the way that TCP works, it is possible for
1500 recently-sent data to be lost if either you close a socket while the
1501 <a href="./../glib/glib/glib-IO-Channels.html#G-IO-IN:CAPS"><code class="literal">G_IO_IN</code></a> condition is set, or else if the remote connection tries to
1502 send something to you after you close the socket but before it has
1503 finished reading all of the data you sent. There is no easy generic
1504 way to avoid this problem; the easiest fix is to design the network
1505 protocol such that the client will never send data "out of turn".
1506 Another solution is for the server to half-close the connection by
1507 calling <a class="link" href="GSocket.html#g-socket-shutdown" title="g_socket_shutdown ()"><code class="function">g_socket_shutdown()</code></a> with only the <em class="parameter"><code>shutdown_write</code></em> flag set,
1508 and then wait for the client to notice this and close its side of the
1509 connection, after which the server can safely call <a class="link" href="GSocket.html#g-socket-close" title="g_socket_close ()"><code class="function">g_socket_close()</code></a>.
1510 (This is what <a class="link" href="GTcpConnection.html" title="GTcpConnection"><span class="type">GTcpConnection</span></a> does if you call
1511 <a class="link" href="GTcpConnection.html#g-tcp-connection-set-graceful-disconnect" title="g_tcp_connection_set_graceful_disconnect ()"><code class="function">g_tcp_connection_set_graceful_disconnect()</code></a>. But of course, this
1512 only works if the client will close its connection after the server
1513 does.)
1514 </p>
1515 <div class="variablelist"><table border="0">
1516 <col align="left" valign="top">
1517 <tbody>
1518 <tr>
1519 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
1520 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>
1521 </td>
1522 </tr>
1523 <tr>
1524 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
1525 <td>
1526 <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> for error reporting, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore.</td>
1527 </tr>
1528 <tr>
1529 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1530 <td>
1531 <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> on success, <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> on error</td>
1532 </tr>
1533 </tbody>
1534 </table></div>
1535 <p class="since">Since 2.22</p>
1536 </div>
1537 <hr>
1538 <div class="refsect2">
1539 <a name="g-socket-is-closed"></a><h3>g_socket_is_closed ()</h3>
1540 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            g_socket_is_closed                  (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>);</pre>
1541 <p>
1542 Checks whether a socket is closed.
1543 </p>
1544 <div class="variablelist"><table border="0">
1545 <col align="left" valign="top">
1546 <tbody>
1547 <tr>
1548 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
1549 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>
1550 </td>
1551 </tr>
1552 <tr>
1553 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1554 <td>
1555 <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if socket is closed, <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise</td>
1556 </tr>
1557 </tbody>
1558 </table></div>
1559 <p class="since">Since 2.22</p>
1560 </div>
1561 <hr>
1562 <div class="refsect2">
1563 <a name="g-socket-shutdown"></a><h3>g_socket_shutdown ()</h3>
1564 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            g_socket_shutdown                   (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
1565                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> shutdown_read</code></em>,
1566                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> shutdown_write</code></em>,
1567                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
1568 <p>
1569 Shut down part of a full-duplex connection.
1570 </p>
1571 <p>
1572 If <em class="parameter"><code>shutdown_read</code></em> is <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> then the receiving side of the connection
1573 is shut down, and further reading is disallowed.
1574 </p>
1575 <p>
1576 If <em class="parameter"><code>shutdown_write</code></em> is <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> then the sending side of the connection
1577 is shut down, and further writing is disallowed.
1578 </p>
1579 <p>
1580 It is allowed for both <em class="parameter"><code>shutdown_read</code></em> and <em class="parameter"><code>shutdown_write</code></em> to be <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>.
1581 </p>
1582 <p>
1583 One example where this is used is graceful disconnect for TCP connections
1584 where you close the sending side, then wait for the other side to close
1585 the connection, thus ensuring that the other side saw all sent data.
1586 </p>
1587 <div class="variablelist"><table border="0">
1588 <col align="left" valign="top">
1589 <tbody>
1590 <tr>
1591 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
1592 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>
1593 </td>
1594 </tr>
1595 <tr>
1596 <td><p><span class="term"><em class="parameter"><code>shutdown_read</code></em> :</span></p></td>
1597 <td>whether to shut down the read side</td>
1598 </tr>
1599 <tr>
1600 <td><p><span class="term"><em class="parameter"><code>shutdown_write</code></em> :</span></p></td>
1601 <td>whether to shut down the write side</td>
1602 </tr>
1603 <tr>
1604 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
1605 <td>
1606 <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> for error reporting, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore.</td>
1607 </tr>
1608 <tr>
1609 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1610 <td>
1611 <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> on success, <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> on error</td>
1612 </tr>
1613 </tbody>
1614 </table></div>
1615 <p class="since">Since 2.22</p>
1616 </div>
1617 <hr>
1618 <div class="refsect2">
1619 <a name="g-socket-is-connected"></a><h3>g_socket_is_connected ()</h3>
1620 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            g_socket_is_connected               (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>);</pre>
1621 <p>
1622 Check whether the socket is connected. This is only useful for
1623 connection-oriented sockets.
1624 </p>
1625 <div class="variablelist"><table border="0">
1626 <col align="left" valign="top">
1627 <tbody>
1628 <tr>
1629 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
1630 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>.</td>
1631 </tr>
1632 <tr>
1633 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1634 <td>
1635 <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if socket is connected, <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise.</td>
1636 </tr>
1637 </tbody>
1638 </table></div>
1639 <p class="since">Since 2.22</p>
1640 </div>
1641 <hr>
1642 <div class="refsect2">
1643 <a name="g-socket-create-source"></a><h3>g_socket_create_source ()</h3>
1644 <pre class="programlisting"><a href="./../glib/glib/glib-The-Main-Event-Loop.html#GSource"><span class="returnvalue">GSource</span></a> *           g_socket_create_source              (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
1645                                                          <em class="parameter"><code><a href="./../glib/glib/glib-IO-Channels.html#GIOCondition"><span class="type">GIOCondition</span></a> condition</code></em>,
1646                                                          <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>);</pre>
1647 <p>
1648 Creates a <a href="./../glib/glib/glib-The-Main-Event-Loop.html#GSource"><code class="literal">GSource</code></a> that can be attached to a <a href="./../glib/glib/glib-The-Main-Event-Loop.html#GMainContext"><code class="literal">GMainContext</code></a> to monitor
1649 for the availibility of the specified <em class="parameter"><code>condition</code></em> on the socket.
1650 </p>
1651 <p>
1652 The callback on the source is of the <a class="link" href="GSocket.html#GSocketSourceFunc" title="GSocketSourceFunc ()"><span class="type">GSocketSourceFunc</span></a> type.
1653 </p>
1654 <p>
1655 It is meaningless to specify <a href="./../glib/glib/glib-IO-Channels.html#G-IO-ERR:CAPS"><code class="literal">G_IO_ERR</code></a> or <a href="./../glib/glib/glib-IO-Channels.html#G-IO-HUP:CAPS"><code class="literal">G_IO_HUP</code></a> in <em class="parameter"><code>condition</code></em>;
1656 these conditions will always be reported output if they are true.
1657 </p>
1658 <p>
1659 <em class="parameter"><code>cancellable</code></em> if not <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> can be used to cancel the source, which will
1660 cause the source to trigger, reporting the current condition (which
1661 is likely 0 unless cancellation happened at the same time as a
1662 condition change). You can check for this in the callback using
1663 <a class="link" href="GCancellable.html#g-cancellable-is-cancelled" title="g_cancellable_is_cancelled ()"><code class="function">g_cancellable_is_cancelled()</code></a>.
1664 </p>
1665 <p>
1666 If <em class="parameter"><code>socket</code></em> has a timeout set, and it is reached before <em class="parameter"><code>condition</code></em>
1667 occurs, the source will then trigger anyway, reporting <a href="./../glib/glib/glib-IO-Channels.html#G-IO-IN:CAPS"><code class="literal">G_IO_IN</code></a> or
1668 <a href="./../glib/glib/glib-IO-Channels.html#G-IO-OUT:CAPS"><code class="literal">G_IO_OUT</code></a> depending on <em class="parameter"><code>condition</code></em>. However, <em class="parameter"><code>socket</code></em> will have been
1669 marked as having had a timeout, and so the next <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> I/O method
1670 you call will then fail with a <a class="link" href="gio-GIOError.html#G-IO-ERROR-TIMED-OUT:CAPS"><code class="literal">G_IO_ERROR_TIMED_OUT</code></a>.
1671 </p>
1672 <div class="variablelist"><table border="0">
1673 <col align="left" valign="top">
1674 <tbody>
1675 <tr>
1676 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
1677 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>
1678 </td>
1679 </tr>
1680 <tr>
1681 <td><p><span class="term"><em class="parameter"><code>condition</code></em> :</span></p></td>
1682 <td>a <a href="./../glib/glib/glib-IO-Channels.html#GIOCondition"><span class="type">GIOCondition</span></a> mask to monitor</td>
1683 </tr>
1684 <tr>
1685 <td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
1686 <td>a <a class="link" href="GCancellable.html" title="GCancellable"><code class="literal">GCancellable</code></a> or <a href="./../glib/glib/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>
1687 </td>
1688 </tr>
1689 <tr>
1690 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1691 <td>a newly allocated <a href="./../glib/glib/glib-The-Main-Event-Loop.html#GSource"><code class="literal">GSource</code></a>, free with <a href="./../glib/glib/glib-The-Main-Event-Loop.html#g-source-unref"><code class="function">g_source_unref()</code></a>. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
1692 </td>
1693 </tr>
1694 </tbody>
1695 </table></div>
1696 <p class="since">Since 2.22</p>
1697 </div>
1698 <hr>
1699 <div class="refsect2">
1700 <a name="g-socket-condition-check"></a><h3>g_socket_condition_check ()</h3>
1701 <pre class="programlisting"><a href="./../glib/glib/glib-IO-Channels.html#GIOCondition"><span class="returnvalue">GIOCondition</span></a>        g_socket_condition_check            (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
1702                                                          <em class="parameter"><code><a href="./../glib/glib/glib-IO-Channels.html#GIOCondition"><span class="type">GIOCondition</span></a> condition</code></em>);</pre>
1703 <p>
1704 Checks on the readiness of <em class="parameter"><code>socket</code></em> to perform operations.
1705 The operations specified in <em class="parameter"><code>condition</code></em> are checked for and masked
1706 against the currently-satisfied conditions on <em class="parameter"><code>socket</code></em>. The result
1707 is returned.
1708 </p>
1709 <p>
1710 Note that on Windows, it is possible for an operation to return
1711 <a class="link" href="gio-GIOError.html#G-IO-ERROR-WOULD-BLOCK:CAPS"><code class="literal">G_IO_ERROR_WOULD_BLOCK</code></a> even immediately after
1712 <a class="link" href="GSocket.html#g-socket-condition-check" title="g_socket_condition_check ()"><code class="function">g_socket_condition_check()</code></a> has claimed that the socket is ready for
1713 writing. Rather than calling <a class="link" href="GSocket.html#g-socket-condition-check" title="g_socket_condition_check ()"><code class="function">g_socket_condition_check()</code></a> and then
1714 writing to the socket if it succeeds, it is generally better to
1715 simply try writing to the socket right away, and try again later if
1716 the initial attempt returns <a class="link" href="gio-GIOError.html#G-IO-ERROR-WOULD-BLOCK:CAPS"><code class="literal">G_IO_ERROR_WOULD_BLOCK</code></a>.
1717 </p>
1718 <p>
1719 It is meaningless to specify <a href="./../glib/glib/glib-IO-Channels.html#G-IO-ERR:CAPS"><code class="literal">G_IO_ERR</code></a> or <a href="./../glib/glib/glib-IO-Channels.html#G-IO-HUP:CAPS"><code class="literal">G_IO_HUP</code></a> in condition;
1720 these conditions will always be set in the output if they are true.
1721 </p>
1722 <p>
1723 This call never blocks.
1724 </p>
1725 <div class="variablelist"><table border="0">
1726 <col align="left" valign="top">
1727 <tbody>
1728 <tr>
1729 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
1730 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>
1731 </td>
1732 </tr>
1733 <tr>
1734 <td><p><span class="term"><em class="parameter"><code>condition</code></em> :</span></p></td>
1735 <td>a <a href="./../glib/glib/glib-IO-Channels.html#GIOCondition"><span class="type">GIOCondition</span></a> mask to check</td>
1736 </tr>
1737 <tr>
1738 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1739 <td>the <em class="parameter"><code>GIOCondition</code></em> mask of the current state</td>
1740 </tr>
1741 </tbody>
1742 </table></div>
1743 <p class="since">Since 2.22</p>
1744 </div>
1745 <hr>
1746 <div class="refsect2">
1747 <a name="g-socket-condition-wait"></a><h3>g_socket_condition_wait ()</h3>
1748 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            g_socket_condition_wait             (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
1749                                                          <em class="parameter"><code><a href="./../glib/glib/glib-IO-Channels.html#GIOCondition"><span class="type">GIOCondition</span></a> condition</code></em>,
1750                                                          <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
1751                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
1752 <p>
1753 Waits for <em class="parameter"><code>condition</code></em> to become true on <em class="parameter"><code>socket</code></em>. When the condition
1754 is met, <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> is returned.
1755 </p>
1756 <p>
1757 If <em class="parameter"><code>cancellable</code></em> is cancelled before the condition is met, or if the
1758 socket has a timeout set and it is reached before the condition is
1759 met, then <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> is returned and <em class="parameter"><code>error</code></em>, if non-<a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, is set to
1760 the appropriate value (<a class="link" href="gio-GIOError.html#G-IO-ERROR-CANCELLED:CAPS"><code class="literal">G_IO_ERROR_CANCELLED</code></a> or
1761 <a class="link" href="gio-GIOError.html#G-IO-ERROR-TIMED-OUT:CAPS"><code class="literal">G_IO_ERROR_TIMED_OUT</code></a>).
1762 </p>
1763 <p>
1764 See also <a class="link" href="GSocket.html#g-socket-condition-timed-wait" title="g_socket_condition_timed_wait ()"><code class="function">g_socket_condition_timed_wait()</code></a>.
1765 </p>
1766 <div class="variablelist"><table border="0">
1767 <col align="left" valign="top">
1768 <tbody>
1769 <tr>
1770 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
1771 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>
1772 </td>
1773 </tr>
1774 <tr>
1775 <td><p><span class="term"><em class="parameter"><code>condition</code></em> :</span></p></td>
1776 <td>a <a href="./../glib/glib/glib-IO-Channels.html#GIOCondition"><span class="type">GIOCondition</span></a> mask to wait for</td>
1777 </tr>
1778 <tr>
1779 <td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
1780 <td>a <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a>, or <a href="./../glib/glib/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>
1781 </td>
1782 </tr>
1783 <tr>
1784 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
1785 <td>a <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> pointer, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
1786 </td>
1787 </tr>
1788 <tr>
1789 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1790 <td>
1791 <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the condition was met, <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise</td>
1792 </tr>
1793 </tbody>
1794 </table></div>
1795 <p class="since">Since 2.22</p>
1796 </div>
1797 <hr>
1798 <div class="refsect2">
1799 <a name="g-socket-condition-timed-wait"></a><h3>g_socket_condition_timed_wait ()</h3>
1800 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            g_socket_condition_timed_wait       (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
1801                                                          <em class="parameter"><code><a href="./../glib/glib/glib-IO-Channels.html#GIOCondition"><span class="type">GIOCondition</span></a> condition</code></em>,
1802                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gint64"><span class="type">gint64</span></a> timeout</code></em>,
1803                                                          <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
1804                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
1805 <p>
1806 Waits for up to <em class="parameter"><code>timeout</code></em> microseconds for <em class="parameter"><code>condition</code></em> to become true
1807 on <em class="parameter"><code>socket</code></em>. If the condition is met, <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> is returned.
1808 </p>
1809 <p>
1810 If <em class="parameter"><code>cancellable</code></em> is cancelled before the condition is met, or if
1811 <em class="parameter"><code>timeout</code></em> (or the socket's <a class="link" href="GSocket.html#GSocket--timeout" title='The "timeout" property'><span class="type">"timeout"</span></a>) is reached before the
1812 condition is met, then <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> is returned and <em class="parameter"><code>error</code></em>, if non-<a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>,
1813 is set to the appropriate value (<a class="link" href="gio-GIOError.html#G-IO-ERROR-CANCELLED:CAPS"><code class="literal">G_IO_ERROR_CANCELLED</code></a> or
1814 <a class="link" href="gio-GIOError.html#G-IO-ERROR-TIMED-OUT:CAPS"><code class="literal">G_IO_ERROR_TIMED_OUT</code></a>).
1815 </p>
1816 <p>
1817 If you don't want a timeout, use <a class="link" href="GSocket.html#g-socket-condition-wait" title="g_socket_condition_wait ()"><code class="function">g_socket_condition_wait()</code></a>.
1818 (Alternatively, you can pass -1 for <em class="parameter"><code>timeout</code></em>.)
1819 </p>
1820 <p>
1821 Note that although <em class="parameter"><code>timeout</code></em> is in microseconds for consistency with
1822 other GLib APIs, this function actually only has millisecond
1823 resolution, and the behavior is undefined if <em class="parameter"><code>timeout</code></em> is not an
1824 exact number of milliseconds.
1825 </p>
1826 <div class="variablelist"><table border="0">
1827 <col align="left" valign="top">
1828 <tbody>
1829 <tr>
1830 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
1831 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>
1832 </td>
1833 </tr>
1834 <tr>
1835 <td><p><span class="term"><em class="parameter"><code>condition</code></em> :</span></p></td>
1836 <td>a <a href="./../glib/glib/glib-IO-Channels.html#GIOCondition"><span class="type">GIOCondition</span></a> mask to wait for</td>
1837 </tr>
1838 <tr>
1839 <td><p><span class="term"><em class="parameter"><code>timeout</code></em> :</span></p></td>
1840 <td>the maximum time (in microseconds) to wait, or -1</td>
1841 </tr>
1842 <tr>
1843 <td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
1844 <td>a <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a>, or <a href="./../glib/glib/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>
1845 </td>
1846 </tr>
1847 <tr>
1848 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
1849 <td>a <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> pointer, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
1850 </td>
1851 </tr>
1852 <tr>
1853 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1854 <td>
1855 <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the condition was met, <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise</td>
1856 </tr>
1857 </tbody>
1858 </table></div>
1859 <p class="since">Since 2.32</p>
1860 </div>
1861 <hr>
1862 <div class="refsect2">
1863 <a name="g-socket-get-available-bytes"></a><h3>g_socket_get_available_bytes ()</h3>
1864 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gssize"><span class="returnvalue">gssize</span></a>              g_socket_get_available_bytes        (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>);</pre>
1865 <p>
1866 Get the amount of data pending in the OS input buffer.
1867 </p>
1868 <div class="variablelist"><table border="0">
1869 <col align="left" valign="top">
1870 <tbody>
1871 <tr>
1872 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
1873 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>
1874 </td>
1875 </tr>
1876 <tr>
1877 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1878 <td>the number of bytes that can be read from the socket
1879 without blocking or -1 on error.</td>
1880 </tr>
1881 </tbody>
1882 </table></div>
1883 <p class="since">Since 2.32</p>
1884 </div>
1885 <hr>
1886 <div class="refsect2">
1887 <a name="g-socket-set-listen-backlog"></a><h3>g_socket_set_listen_backlog ()</h3>
1888 <pre class="programlisting"><span class="returnvalue">void</span>                g_socket_set_listen_backlog         (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
1889                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> backlog</code></em>);</pre>
1890 <p>
1891 Sets the maximum number of outstanding connections allowed
1892 when listening on this socket. If more clients than this are
1893 connecting to the socket and the application is not handling them
1894 on time then the new connections will be refused.
1895 </p>
1896 <p>
1897 Note that this must be called before <a class="link" href="GSocket.html#g-socket-listen" title="g_socket_listen ()"><code class="function">g_socket_listen()</code></a> and has no
1898 effect if called after that.
1899 </p>
1900 <div class="variablelist"><table border="0">
1901 <col align="left" valign="top">
1902 <tbody>
1903 <tr>
1904 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
1905 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>.</td>
1906 </tr>
1907 <tr>
1908 <td><p><span class="term"><em class="parameter"><code>backlog</code></em> :</span></p></td>
1909 <td>the maximum number of pending connections.</td>
1910 </tr>
1911 </tbody>
1912 </table></div>
1913 <p class="since">Since 2.22</p>
1914 </div>
1915 <hr>
1916 <div class="refsect2">
1917 <a name="g-socket-get-listen-backlog"></a><h3>g_socket_get_listen_backlog ()</h3>
1918 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a>                g_socket_get_listen_backlog         (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>);</pre>
1919 <p>
1920 Gets the listen backlog setting of the socket. For details on this,
1921 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>.
1922 </p>
1923 <div class="variablelist"><table border="0">
1924 <col align="left" valign="top">
1925 <tbody>
1926 <tr>
1927 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
1928 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>.</td>
1929 </tr>
1930 <tr>
1931 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1932 <td>the maximum number of pending connections.</td>
1933 </tr>
1934 </tbody>
1935 </table></div>
1936 <p class="since">Since 2.22</p>
1937 </div>
1938 <hr>
1939 <div class="refsect2">
1940 <a name="g-socket-get-blocking"></a><h3>g_socket_get_blocking ()</h3>
1941 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            g_socket_get_blocking               (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>);</pre>
1942 <p>
1943 Gets the blocking mode of the socket. For details on blocking I/O,
1944 see <a class="link" href="GSocket.html#g-socket-set-blocking" title="g_socket_set_blocking ()"><code class="function">g_socket_set_blocking()</code></a>.
1945 </p>
1946 <div class="variablelist"><table border="0">
1947 <col align="left" valign="top">
1948 <tbody>
1949 <tr>
1950 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
1951 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>.</td>
1952 </tr>
1953 <tr>
1954 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1955 <td>
1956 <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if blocking I/O is used, <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise.</td>
1957 </tr>
1958 </tbody>
1959 </table></div>
1960 <p class="since">Since 2.22</p>
1961 </div>
1962 <hr>
1963 <div class="refsect2">
1964 <a name="g-socket-set-blocking"></a><h3>g_socket_set_blocking ()</h3>
1965 <pre class="programlisting"><span class="returnvalue">void</span>                g_socket_set_blocking               (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
1966                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> blocking</code></em>);</pre>
1967 <p>
1968 Sets the blocking mode of the socket. In blocking mode
1969 all operations block until they succeed or there is an error. In
1970 non-blocking mode all functions return results immediately or
1971 with a <a class="link" href="gio-GIOError.html#G-IO-ERROR-WOULD-BLOCK:CAPS"><code class="literal">G_IO_ERROR_WOULD_BLOCK</code></a> error.
1972 </p>
1973 <p>
1974 All sockets are created in blocking mode. However, note that the
1975 platform level socket is always non-blocking, and blocking mode
1976 is a GSocket level feature.
1977 </p>
1978 <div class="variablelist"><table border="0">
1979 <col align="left" valign="top">
1980 <tbody>
1981 <tr>
1982 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
1983 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>.</td>
1984 </tr>
1985 <tr>
1986 <td><p><span class="term"><em class="parameter"><code>blocking</code></em> :</span></p></td>
1987 <td>Whether to use blocking I/O or not.</td>
1988 </tr>
1989 </tbody>
1990 </table></div>
1991 <p class="since">Since 2.22</p>
1992 </div>
1993 <hr>
1994 <div class="refsect2">
1995 <a name="g-socket-get-keepalive"></a><h3>g_socket_get_keepalive ()</h3>
1996 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            g_socket_get_keepalive              (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>);</pre>
1997 <p>
1998 Gets the keepalive mode of the socket. For details on this,
1999 see <a class="link" href="GSocket.html#g-socket-set-keepalive" title="g_socket_set_keepalive ()"><code class="function">g_socket_set_keepalive()</code></a>.
2000 </p>
2001 <div class="variablelist"><table border="0">
2002 <col align="left" valign="top">
2003 <tbody>
2004 <tr>
2005 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
2006 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>.</td>
2007 </tr>
2008 <tr>
2009 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
2010 <td>
2011 <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if keepalive is active, <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise.</td>
2012 </tr>
2013 </tbody>
2014 </table></div>
2015 <p class="since">Since 2.22</p>
2016 </div>
2017 <hr>
2018 <div class="refsect2">
2019 <a name="g-socket-set-keepalive"></a><h3>g_socket_set_keepalive ()</h3>
2020 <pre class="programlisting"><span class="returnvalue">void</span>                g_socket_set_keepalive              (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
2021                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> keepalive</code></em>);</pre>
2022 <p>
2023 Sets or unsets the <code class="literal">SO_KEEPALIVE</code> flag on the underlying socket. When
2024 this flag is set on a socket, the system will attempt to verify that the
2025 remote socket endpoint is still present if a sufficiently long period of
2026 time passes with no data being exchanged. If the system is unable to
2027 verify the presence of the remote endpoint, it will automatically close
2028 the connection.
2029 </p>
2030 <p>
2031 This option is only functional on certain kinds of sockets. (Notably,
2032 <a class="link" href="GSocket.html#G-SOCKET-PROTOCOL-TCP:CAPS"><code class="literal">G_SOCKET_PROTOCOL_TCP</code></a> sockets.)
2033 </p>
2034 <p>
2035 The exact time between pings is system- and protocol-dependent, but will
2036 normally be at least two hours. Most commonly, you would set this flag
2037 on a server socket if you want to allow clients to remain idle for long
2038 periods of time, but also want to ensure that connections are eventually
2039 garbage-collected if clients crash or become unreachable.
2040 </p>
2041 <div class="variablelist"><table border="0">
2042 <col align="left" valign="top">
2043 <tbody>
2044 <tr>
2045 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
2046 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>.</td>
2047 </tr>
2048 <tr>
2049 <td><p><span class="term"><em class="parameter"><code>keepalive</code></em> :</span></p></td>
2050 <td>Value for the keepalive flag</td>
2051 </tr>
2052 </tbody>
2053 </table></div>
2054 <p class="since">Since 2.22</p>
2055 </div>
2056 <hr>
2057 <div class="refsect2">
2058 <a name="g-socket-get-timeout"></a><h3>g_socket_get_timeout ()</h3>
2059 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#guint"><span class="returnvalue">guint</span></a>               g_socket_get_timeout                (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>);</pre>
2060 <p>
2061 Gets the timeout setting of the socket. For details on this, see
2062 <a class="link" href="GSocket.html#g-socket-set-timeout" title="g_socket_set_timeout ()"><code class="function">g_socket_set_timeout()</code></a>.
2063 </p>
2064 <div class="variablelist"><table border="0">
2065 <col align="left" valign="top">
2066 <tbody>
2067 <tr>
2068 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
2069 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>.</td>
2070 </tr>
2071 <tr>
2072 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
2073 <td>the timeout in seconds</td>
2074 </tr>
2075 </tbody>
2076 </table></div>
2077 <p class="since">Since 2.26</p>
2078 </div>
2079 <hr>
2080 <div class="refsect2">
2081 <a name="g-socket-set-timeout"></a><h3>g_socket_set_timeout ()</h3>
2082 <pre class="programlisting"><span class="returnvalue">void</span>                g_socket_set_timeout                (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
2083                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#guint"><span class="type">guint</span></a> timeout</code></em>);</pre>
2084 <p>
2085 Sets the time in seconds after which I/O operations on <em class="parameter"><code>socket</code></em> will
2086 time out if they have not yet completed.
2087 </p>
2088 <p>
2089 On a blocking socket, this means that any blocking <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>
2090 operation will time out after <em class="parameter"><code>timeout</code></em> seconds of inactivity,
2091 returning <a class="link" href="gio-GIOError.html#G-IO-ERROR-TIMED-OUT:CAPS"><code class="literal">G_IO_ERROR_TIMED_OUT</code></a>.
2092 </p>
2093 <p>
2094 On a non-blocking socket, calls to <a class="link" href="GSocket.html#g-socket-condition-wait" title="g_socket_condition_wait ()"><code class="function">g_socket_condition_wait()</code></a> will
2095 also fail with <a class="link" href="gio-GIOError.html#G-IO-ERROR-TIMED-OUT:CAPS"><code class="literal">G_IO_ERROR_TIMED_OUT</code></a> after the given time. Sources
2096 created with <a class="link" href="GSocket.html#g-socket-create-source" title="g_socket_create_source ()"><code class="function">g_socket_create_source()</code></a> will trigger after
2097 <em class="parameter"><code>timeout</code></em> seconds of inactivity, with the requested condition
2098 set, at which point calling <a class="link" href="GSocket.html#g-socket-receive" title="g_socket_receive ()"><code class="function">g_socket_receive()</code></a>, <a class="link" href="GSocket.html#g-socket-send" title="g_socket_send ()"><code class="function">g_socket_send()</code></a>,
2099 <a class="link" href="GSocket.html#g-socket-check-connect-result" title="g_socket_check_connect_result ()"><code class="function">g_socket_check_connect_result()</code></a>, etc, will fail with
2100 <a class="link" href="gio-GIOError.html#G-IO-ERROR-TIMED-OUT:CAPS"><code class="literal">G_IO_ERROR_TIMED_OUT</code></a>.
2101 </p>
2102 <p>
2103 If <em class="parameter"><code>timeout</code></em> is 0 (the default), operations will never time out
2104 on their own.
2105 </p>
2106 <p>
2107 Note that if an I/O operation is interrupted by a signal, this may
2108 cause the timeout to be reset.
2109 </p>
2110 <div class="variablelist"><table border="0">
2111 <col align="left" valign="top">
2112 <tbody>
2113 <tr>
2114 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
2115 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>.</td>
2116 </tr>
2117 <tr>
2118 <td><p><span class="term"><em class="parameter"><code>timeout</code></em> :</span></p></td>
2119 <td>the timeout for <em class="parameter"><code>socket</code></em>, in seconds, or 0 for none</td>
2120 </tr>
2121 </tbody>
2122 </table></div>
2123 <p class="since">Since 2.26</p>
2124 </div>
2125 <hr>
2126 <div class="refsect2">
2127 <a name="g-socket-set-ttl"></a><h3>g_socket_set_ttl ()</h3>
2128 <pre class="programlisting"><span class="returnvalue">void</span>                g_socket_set_ttl                    (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
2129                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#guint"><span class="type">guint</span></a> ttl</code></em>);</pre>
2130 <p>
2131 Sets the time-to-live for outgoing unicast packets on <em class="parameter"><code>socket</code></em>.
2132 By default the platform-specific default value is used.
2133 </p>
2134 <div class="variablelist"><table border="0">
2135 <col align="left" valign="top">
2136 <tbody>
2137 <tr>
2138 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
2139 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>.</td>
2140 </tr>
2141 <tr>
2142 <td><p><span class="term"><em class="parameter"><code>ttl</code></em> :</span></p></td>
2143 <td>the time-to-live value for all unicast packets on <em class="parameter"><code>socket</code></em>
2144 </td>
2145 </tr>
2146 </tbody>
2147 </table></div>
2148 <p class="since">Since 2.32</p>
2149 </div>
2150 <hr>
2151 <div class="refsect2">
2152 <a name="g-socket-get-ttl"></a><h3>g_socket_get_ttl ()</h3>
2153 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#guint"><span class="returnvalue">guint</span></a>               g_socket_get_ttl                    (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>);</pre>
2154 <p>
2155 Gets the unicast time-to-live setting on <em class="parameter"><code>socket</code></em>; see
2156 <a class="link" href="GSocket.html#g-socket-set-ttl" title="g_socket_set_ttl ()"><code class="function">g_socket_set_ttl()</code></a> for more details.
2157 </p>
2158 <div class="variablelist"><table border="0">
2159 <col align="left" valign="top">
2160 <tbody>
2161 <tr>
2162 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
2163 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>.</td>
2164 </tr>
2165 <tr>
2166 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
2167 <td>the time-to-live setting on <em class="parameter"><code>socket</code></em>
2168 </td>
2169 </tr>
2170 </tbody>
2171 </table></div>
2172 <p class="since">Since 2.32</p>
2173 </div>
2174 <hr>
2175 <div class="refsect2">
2176 <a name="g-socket-get-broadcast"></a><h3>g_socket_get_broadcast ()</h3>
2177 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            g_socket_get_broadcast              (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>);</pre>
2178 <p>
2179 Gets the broadcast setting on <em class="parameter"><code>socket</code></em>; if <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>,
2180 it is possible to send packets to broadcast
2181 addresses or receive from broadcast addresses.
2182 </p>
2183 <div class="variablelist"><table border="0">
2184 <col align="left" valign="top">
2185 <tbody>
2186 <tr>
2187 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
2188 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>.</td>
2189 </tr>
2190 <tr>
2191 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
2192 <td>the broadcast setting on <em class="parameter"><code>socket</code></em>
2193 </td>
2194 </tr>
2195 </tbody>
2196 </table></div>
2197 <p class="since">Since 2.32</p>
2198 </div>
2199 <hr>
2200 <div class="refsect2">
2201 <a name="g-socket-set-broadcast"></a><h3>g_socket_set_broadcast ()</h3>
2202 <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>,
2203                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> broadcast</code></em>);</pre>
2204 <p>
2205 Sets whether <em class="parameter"><code>socket</code></em> should allow sending to and receiving from
2206 broadcast addresses. This is <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> by default.
2207 </p>
2208 <div class="variablelist"><table border="0">
2209 <col align="left" valign="top">
2210 <tbody>
2211 <tr>
2212 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
2213 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>.</td>
2214 </tr>
2215 <tr>
2216 <td><p><span class="term"><em class="parameter"><code>broadcast</code></em> :</span></p></td>
2217 <td>whether <em class="parameter"><code>socket</code></em> should allow sending to and receiving
2218 from broadcast addresses</td>
2219 </tr>
2220 </tbody>
2221 </table></div>
2222 <p class="since">Since 2.32</p>
2223 </div>
2224 <hr>
2225 <div class="refsect2">
2226 <a name="g-socket-get-family"></a><h3>g_socket_get_family ()</h3>
2227 <pre class="programlisting"><a class="link" href="GSocketAddress.html#GSocketFamily" title="enum GSocketFamily"><span class="returnvalue">GSocketFamily</span></a>       g_socket_get_family                 (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>);</pre>
2228 <p>
2229 Gets the socket family of the socket.
2230 </p>
2231 <div class="variablelist"><table border="0">
2232 <col align="left" valign="top">
2233 <tbody>
2234 <tr>
2235 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
2236 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>.</td>
2237 </tr>
2238 <tr>
2239 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
2240 <td>a <a class="link" href="GSocketAddress.html#GSocketFamily" title="enum GSocketFamily"><span class="type">GSocketFamily</span></a>
2241 </td>
2242 </tr>
2243 </tbody>
2244 </table></div>
2245 <p class="since">Since 2.22</p>
2246 </div>
2247 <hr>
2248 <div class="refsect2">
2249 <a name="g-socket-get-fd"></a><h3>g_socket_get_fd ()</h3>
2250 <pre class="programlisting"><span class="returnvalue">int</span>                 g_socket_get_fd                     (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>);</pre>
2251 <p>
2252 Returns the underlying OS socket object. On unix this
2253 is a socket file descriptor, and on windows this is
2254 a Winsock2 SOCKET handle. This may be useful for
2255 doing platform specific or otherwise unusual operations
2256 on the socket.
2257 </p>
2258 <div class="variablelist"><table border="0">
2259 <col align="left" valign="top">
2260 <tbody>
2261 <tr>
2262 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
2263 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>.</td>
2264 </tr>
2265 <tr>
2266 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
2267 <td>the file descriptor of the socket.</td>
2268 </tr>
2269 </tbody>
2270 </table></div>
2271 <p class="since">Since 2.22</p>
2272 </div>
2273 <hr>
2274 <div class="refsect2">
2275 <a name="g-socket-get-local-address"></a><h3>g_socket_get_local_address ()</h3>
2276 <pre class="programlisting"><a class="link" href="GSocketAddress.html" title="GSocketAddress"><span class="returnvalue">GSocketAddress</span></a> *    g_socket_get_local_address          (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
2277                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
2278 <p>
2279 Try to get the local address of a bound socket. This is only
2280 useful if the socket has been bound to a local address,
2281 either explicitly or implicitly when connecting.
2282 </p>
2283 <div class="variablelist"><table border="0">
2284 <col align="left" valign="top">
2285 <tbody>
2286 <tr>
2287 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
2288 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>.</td>
2289 </tr>
2290 <tr>
2291 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
2292 <td>
2293 <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> for error reporting, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore.</td>
2294 </tr>
2295 <tr>
2296 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
2297 <td>a <a class="link" href="GSocketAddress.html" title="GSocketAddress"><span class="type">GSocketAddress</span></a> or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on error.
2298 Free the returned object with <a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#g-object-unref"><code class="function">g_object_unref()</code></a>. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
2299 </td>
2300 </tr>
2301 </tbody>
2302 </table></div>
2303 <p class="since">Since 2.22</p>
2304 </div>
2305 <hr>
2306 <div class="refsect2">
2307 <a name="g-socket-get-protocol"></a><h3>g_socket_get_protocol ()</h3>
2308 <pre class="programlisting"><a class="link" href="GSocket.html#GSocketProtocol" title="enum GSocketProtocol"><span class="returnvalue">GSocketProtocol</span></a>     g_socket_get_protocol               (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>);</pre>
2309 <p>
2310 Gets the socket protocol id the socket was created with.
2311 In case the protocol is unknown, -1 is returned.
2312 </p>
2313 <div class="variablelist"><table border="0">
2314 <col align="left" valign="top">
2315 <tbody>
2316 <tr>
2317 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
2318 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>.</td>
2319 </tr>
2320 <tr>
2321 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
2322 <td>a protocol id, or -1 if unknown</td>
2323 </tr>
2324 </tbody>
2325 </table></div>
2326 <p class="since">Since 2.22</p>
2327 </div>
2328 <hr>
2329 <div class="refsect2">
2330 <a name="g-socket-get-remote-address"></a><h3>g_socket_get_remote_address ()</h3>
2331 <pre class="programlisting"><a class="link" href="GSocketAddress.html" title="GSocketAddress"><span class="returnvalue">GSocketAddress</span></a> *    g_socket_get_remote_address         (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
2332                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
2333 <p>
2334 Try to get the remove address of a connected socket. This is only
2335 useful for connection oriented sockets that have been connected.
2336 </p>
2337 <div class="variablelist"><table border="0">
2338 <col align="left" valign="top">
2339 <tbody>
2340 <tr>
2341 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
2342 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>.</td>
2343 </tr>
2344 <tr>
2345 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
2346 <td>
2347 <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> for error reporting, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore.</td>
2348 </tr>
2349 <tr>
2350 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
2351 <td>a <a class="link" href="GSocketAddress.html" title="GSocketAddress"><span class="type">GSocketAddress</span></a> or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on error.
2352 Free the returned object with <a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#g-object-unref"><code class="function">g_object_unref()</code></a>. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
2353 </td>
2354 </tr>
2355 </tbody>
2356 </table></div>
2357 <p class="since">Since 2.22</p>
2358 </div>
2359 <hr>
2360 <div class="refsect2">
2361 <a name="g-socket-get-socket-type"></a><h3>g_socket_get_socket_type ()</h3>
2362 <pre class="programlisting"><a class="link" href="GSocket.html#GSocketType" title="enum GSocketType"><span class="returnvalue">GSocketType</span></a>         g_socket_get_socket_type            (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>);</pre>
2363 <p>
2364 Gets the socket type of the socket.
2365 </p>
2366 <div class="variablelist"><table border="0">
2367 <col align="left" valign="top">
2368 <tbody>
2369 <tr>
2370 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
2371 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>.</td>
2372 </tr>
2373 <tr>
2374 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
2375 <td>a <a class="link" href="GSocket.html#GSocketType" title="enum GSocketType"><span class="type">GSocketType</span></a>
2376 </td>
2377 </tr>
2378 </tbody>
2379 </table></div>
2380 <p class="since">Since 2.22</p>
2381 </div>
2382 <hr>
2383 <div class="refsect2">
2384 <a name="g-socket-speaks-ipv4"></a><h3>g_socket_speaks_ipv4 ()</h3>
2385 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            g_socket_speaks_ipv4                (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>);</pre>
2386 <p>
2387 Checks if a socket is capable of speaking IPv4.
2388 </p>
2389 <p>
2390 IPv4 sockets are capable of speaking IPv4.  On some operating systems
2391 and under some combinations of circumstances IPv6 sockets are also
2392 capable of speaking IPv4.  See RFC 3493 section 3.7 for more
2393 information.
2394 </p>
2395 <p>
2396 No other types of sockets are currently considered as being capable
2397 of speaking IPv4.
2398 </p>
2399 <div class="variablelist"><table border="0">
2400 <col align="left" valign="top">
2401 <tbody>
2402 <tr>
2403 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
2404 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>
2405 </td>
2406 </tr>
2407 <tr>
2408 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
2409 <td>
2410 <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if this socket can be used with IPv4.</td>
2411 </tr>
2412 </tbody>
2413 </table></div>
2414 <p class="since">Since 2.22</p>
2415 </div>
2416 <hr>
2417 <div class="refsect2">
2418 <a name="g-socket-get-credentials"></a><h3>g_socket_get_credentials ()</h3>
2419 <pre class="programlisting"><a class="link" href="GCredentials.html" title="GCredentials"><span class="returnvalue">GCredentials</span></a> *      g_socket_get_credentials            (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
2420                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
2421 <p>
2422 Returns the credentials of the foreign process connected to this
2423 socket, if any (e.g. it is only supported for <a class="link" href="GSocketAddress.html#G-SOCKET-FAMILY-UNIX:CAPS"><code class="literal">G_SOCKET_FAMILY_UNIX</code></a>
2424 sockets).
2425 </p>
2426 <p>
2427 If this operation isn't supported on the OS, the method fails with
2428 the <a class="link" href="gio-GIOError.html#G-IO-ERROR-NOT-SUPPORTED:CAPS"><code class="literal">G_IO_ERROR_NOT_SUPPORTED</code></a> error. On Linux this is implemented
2429 by reading the <code class="literal">SO_PEERCRED</code> option on the underlying socket.
2430 </p>
2431 <p>
2432 Other ways to obtain credentials from a foreign peer includes the
2433 <a class="link" href="GUnixCredentialsMessage.html" title="GUnixCredentialsMessage"><span class="type">GUnixCredentialsMessage</span></a> type and
2434 <a class="link" href="GUnixConnection.html#g-unix-connection-send-credentials" title="g_unix_connection_send_credentials ()"><code class="function">g_unix_connection_send_credentials()</code></a> /
2435 <a class="link" href="GUnixConnection.html#g-unix-connection-receive-credentials" title="g_unix_connection_receive_credentials ()"><code class="function">g_unix_connection_receive_credentials()</code></a> functions.
2436 </p>
2437 <div class="variablelist"><table border="0">
2438 <col align="left" valign="top">
2439 <tbody>
2440 <tr>
2441 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
2442 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>.</td>
2443 </tr>
2444 <tr>
2445 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
2446 <td>
2447 <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> for error reporting, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore.</td>
2448 </tr>
2449 <tr>
2450 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
2451 <td>
2452 <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if <em class="parameter"><code>error</code></em> is set, otherwise a <a class="link" href="GCredentials.html" title="GCredentials"><span class="type">GCredentials</span></a> object
2453 that must be freed with <a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#g-object-unref"><code class="function">g_object_unref()</code></a>. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
2454 </td>
2455 </tr>
2456 </tbody>
2457 </table></div>
2458 <p class="since">Since 2.26</p>
2459 </div>
2460 <hr>
2461 <div class="refsect2">
2462 <a name="g-socket-join-multicast-group"></a><h3>g_socket_join_multicast_group ()</h3>
2463 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            g_socket_join_multicast_group       (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
2464                                                          <em class="parameter"><code><a class="link" href="GInetAddress.html" title="GInetAddress"><span class="type">GInetAddress</span></a> *group</code></em>,
2465                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> source_specific</code></em>,
2466                                                          <em class="parameter"><code>const <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *iface</code></em>,
2467                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
2468 <p>
2469 Registers <em class="parameter"><code>socket</code></em> to receive multicast messages sent to <em class="parameter"><code>group</code></em>.
2470 <em class="parameter"><code>socket</code></em> must be a <a class="link" href="GSocket.html#G-SOCKET-TYPE-DATAGRAM:CAPS"><code class="literal">G_SOCKET_TYPE_DATAGRAM</code></a> socket, and must have
2471 been bound to an appropriate interface and port with
2472 <a class="link" href="GSocket.html#g-socket-bind" title="g_socket_bind ()"><code class="function">g_socket_bind()</code></a>.
2473 </p>
2474 <p>
2475 If <em class="parameter"><code>iface</code></em> is <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, the system will automatically pick an interface
2476 to bind to based on <em class="parameter"><code>group</code></em>.
2477 </p>
2478 <p>
2479 If <em class="parameter"><code>source_specific</code></em> is <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>, source-specific multicast as defined
2480 in RFC 4604 is used. Note that on older platforms this may fail
2481 with a <a class="link" href="gio-GIOError.html#G-IO-ERROR-NOT-SUPPORTED:CAPS"><code class="literal">G_IO_ERROR_NOT_SUPPORTED</code></a> error.
2482 </p>
2483 <div class="variablelist"><table border="0">
2484 <col align="left" valign="top">
2485 <tbody>
2486 <tr>
2487 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
2488 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>.</td>
2489 </tr>
2490 <tr>
2491 <td><p><span class="term"><em class="parameter"><code>group</code></em> :</span></p></td>
2492 <td>a <a class="link" href="GInetAddress.html" title="GInetAddress"><span class="type">GInetAddress</span></a> specifying the group address to join.</td>
2493 </tr>
2494 <tr>
2495 <td><p><span class="term"><em class="parameter"><code>iface</code></em> :</span></p></td>
2496 <td>Name of the interface to use, or <a href="./../glib/glib/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>
2497 </td>
2498 </tr>
2499 <tr>
2500 <td><p><span class="term"><em class="parameter"><code>source_specific</code></em> :</span></p></td>
2501 <td>
2502 <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if source-specific multicast should be used</td>
2503 </tr>
2504 <tr>
2505 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
2506 <td>
2507 <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> for error reporting, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore.</td>
2508 </tr>
2509 <tr>
2510 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
2511 <td>
2512 <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> on success, <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> on error.</td>
2513 </tr>
2514 </tbody>
2515 </table></div>
2516 <p class="since">Since 2.32</p>
2517 </div>
2518 <hr>
2519 <div class="refsect2">
2520 <a name="g-socket-leave-multicast-group"></a><h3>g_socket_leave_multicast_group ()</h3>
2521 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            g_socket_leave_multicast_group      (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
2522                                                          <em class="parameter"><code><a class="link" href="GInetAddress.html" title="GInetAddress"><span class="type">GInetAddress</span></a> *group</code></em>,
2523                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> source_specific</code></em>,
2524                                                          <em class="parameter"><code>const <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *iface</code></em>,
2525                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
2526 <p>
2527 Removes <em class="parameter"><code>socket</code></em> from the multicast group defined by <em class="parameter"><code>group</code></em>, <em class="parameter"><code>iface</code></em>,
2528 and <em class="parameter"><code>source_specific</code></em> (which must all have the same values they had
2529 when you joined the group).
2530 </p>
2531 <p>
2532 <em class="parameter"><code>socket</code></em> remains bound to its address and port, and can still receive
2533 unicast messages after calling this.
2534 </p>
2535 <div class="variablelist"><table border="0">
2536 <col align="left" valign="top">
2537 <tbody>
2538 <tr>
2539 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
2540 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>.</td>
2541 </tr>
2542 <tr>
2543 <td><p><span class="term"><em class="parameter"><code>group</code></em> :</span></p></td>
2544 <td>a <a class="link" href="GInetAddress.html" title="GInetAddress"><span class="type">GInetAddress</span></a> specifying the group address to leave.</td>
2545 </tr>
2546 <tr>
2547 <td><p><span class="term"><em class="parameter"><code>iface</code></em> :</span></p></td>
2548 <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>
2549 </td>
2550 </tr>
2551 <tr>
2552 <td><p><span class="term"><em class="parameter"><code>source_specific</code></em> :</span></p></td>
2553 <td>
2554 <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if source-specific multicast was used</td>
2555 </tr>
2556 <tr>
2557 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
2558 <td>
2559 <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> for error reporting, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore.</td>
2560 </tr>
2561 <tr>
2562 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
2563 <td>
2564 <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> on success, <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> on error.</td>
2565 </tr>
2566 </tbody>
2567 </table></div>
2568 <p class="since">Since 2.32</p>
2569 </div>
2570 <hr>
2571 <div class="refsect2">
2572 <a name="g-socket-get-multicast-loopback"></a><h3>g_socket_get_multicast_loopback ()</h3>
2573 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            g_socket_get_multicast_loopback     (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>);</pre>
2574 <p>
2575 Gets the multicast loopback setting on <em class="parameter"><code>socket</code></em>; if <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> (the
2576 default), outgoing multicast packets will be looped back to
2577 multicast listeners on the same host.
2578 </p>
2579 <div class="variablelist"><table border="0">
2580 <col align="left" valign="top">
2581 <tbody>
2582 <tr>
2583 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
2584 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>.</td>
2585 </tr>
2586 <tr>
2587 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
2588 <td>the multicast loopback setting on <em class="parameter"><code>socket</code></em>
2589 </td>
2590 </tr>
2591 </tbody>
2592 </table></div>
2593 <p class="since">Since 2.32</p>
2594 </div>
2595 <hr>
2596 <div class="refsect2">
2597 <a name="g-socket-set-multicast-loopback"></a><h3>g_socket_set_multicast_loopback ()</h3>
2598 <pre class="programlisting"><span class="returnvalue">void</span>                g_socket_set_multicast_loopback     (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
2599                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> loopback</code></em>);</pre>
2600 <p>
2601 Sets whether outgoing multicast packets will be received by sockets
2602 listening on that multicast address on the same host. This is <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>
2603 by default.
2604 </p>
2605 <div class="variablelist"><table border="0">
2606 <col align="left" valign="top">
2607 <tbody>
2608 <tr>
2609 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
2610 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>.</td>
2611 </tr>
2612 <tr>
2613 <td><p><span class="term"><em class="parameter"><code>loopback</code></em> :</span></p></td>
2614 <td>whether <em class="parameter"><code>socket</code></em> should receive messages sent to its
2615 multicast groups from the local host</td>
2616 </tr>
2617 </tbody>
2618 </table></div>
2619 <p class="since">Since 2.32</p>
2620 </div>
2621 <hr>
2622 <div class="refsect2">
2623 <a name="g-socket-get-multicast-ttl"></a><h3>g_socket_get_multicast_ttl ()</h3>
2624 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#guint"><span class="returnvalue">guint</span></a>               g_socket_get_multicast_ttl          (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>);</pre>
2625 <p>
2626 Gets the multicast time-to-live setting on <em class="parameter"><code>socket</code></em>; see
2627 <a class="link" href="GSocket.html#g-socket-set-multicast-ttl" title="g_socket_set_multicast_ttl ()"><code class="function">g_socket_set_multicast_ttl()</code></a> for more details.
2628 </p>
2629 <div class="variablelist"><table border="0">
2630 <col align="left" valign="top">
2631 <tbody>
2632 <tr>
2633 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
2634 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>.</td>
2635 </tr>
2636 <tr>
2637 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
2638 <td>the multicast time-to-live setting on <em class="parameter"><code>socket</code></em>
2639 </td>
2640 </tr>
2641 </tbody>
2642 </table></div>
2643 <p class="since">Since 2.32</p>
2644 </div>
2645 <hr>
2646 <div class="refsect2">
2647 <a name="g-socket-set-multicast-ttl"></a><h3>g_socket_set_multicast_ttl ()</h3>
2648 <pre class="programlisting"><span class="returnvalue">void</span>                g_socket_set_multicast_ttl          (<em class="parameter"><code><a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a> *socket</code></em>,
2649                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#guint"><span class="type">guint</span></a> ttl</code></em>);</pre>
2650 <p>
2651 Sets the time-to-live for outgoing multicast datagrams on <em class="parameter"><code>socket</code></em>.
2652 By default, this is 1, meaning that multicast packets will not leave
2653 the local network.
2654 </p>
2655 <div class="variablelist"><table border="0">
2656 <col align="left" valign="top">
2657 <tbody>
2658 <tr>
2659 <td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
2660 <td>a <a class="link" href="GSocket.html" title="GSocket"><span class="type">GSocket</span></a>.</td>
2661 </tr>
2662 <tr>
2663 <td><p><span class="term"><em class="parameter"><code>ttl</code></em> :</span></p></td>
2664 <td>the time-to-live value for all multicast datagrams on <em class="parameter"><code>socket</code></em>
2665 </td>
2666 </tr>
2667 </tbody>
2668 </table></div>
2669 <p class="since">Since 2.32</p>
2670 </div>
2671 </div>
2672 <div class="refsect1">
2673 <a name="GSocket.property-details"></a><h2>Property Details</h2>
2674 <div class="refsect2">
2675 <a name="GSocket--blocking"></a><h3>The <code class="literal">"blocking"</code> property</h3>
2676 <pre class="programlisting">  "blocking"                 <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>              : Read / Write</pre>
2677 <p>Whether or not I/O on this socket is blocking.</p>
2678 <p>Default value: TRUE</p>
2679 </div>
2680 <hr>
2681 <div class="refsect2">
2682 <a name="GSocket--broadcast"></a><h3>The <code class="literal">"broadcast"</code> property</h3>
2683 <pre class="programlisting">  "broadcast"                <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>              : Read / Write</pre>
2684 <p>
2685 Whether the socket should allow sending to and receiving from broadcast addresses.
2686 </p>
2687 <p>Default value: FALSE</p>
2688 <p class="since">Since 2.32</p>
2689 </div>
2690 <hr>
2691 <div class="refsect2">
2692 <a name="GSocket--family"></a><h3>The <code class="literal">"family"</code> property</h3>
2693 <pre class="programlisting">  "family"                   <a class="link" href="GSocketAddress.html#GSocketFamily" title="enum GSocketFamily"><span class="type">GSocketFamily</span></a>         : Read / Write / Construct Only</pre>
2694 <p>The sockets address family.</p>
2695 <p>Default value: G_SOCKET_FAMILY_INVALID</p>
2696 </div>
2697 <hr>
2698 <div class="refsect2">
2699 <a name="GSocket--fd"></a><h3>The <code class="literal">"fd"</code> property</h3>
2700 <pre class="programlisting">  "fd"                       <a href="./../glib/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a>                  : Read / Write / Construct Only</pre>
2701 <p>The sockets file descriptor.</p>
2702 <p>Default value: -1</p>
2703 </div>
2704 <hr>
2705 <div class="refsect2">
2706 <a name="GSocket--keepalive"></a><h3>The <code class="literal">"keepalive"</code> property</h3>
2707 <pre class="programlisting">  "keepalive"                <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>              : Read / Write</pre>
2708 <p>Keep connection alive by sending periodic pings.</p>
2709 <p>Default value: FALSE</p>
2710 </div>
2711 <hr>
2712 <div class="refsect2">
2713 <a name="GSocket--listen-backlog"></a><h3>The <code class="literal">"listen-backlog"</code> property</h3>
2714 <pre class="programlisting">  "listen-backlog"           <a href="./../glib/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a>                  : Read / Write</pre>
2715 <p>Outstanding connections in the listen queue.</p>
2716 <p>Allowed values: [0,128]</p>
2717 <p>Default value: 10</p>
2718 </div>
2719 <hr>
2720 <div class="refsect2">
2721 <a name="GSocket--local-address"></a><h3>The <code class="literal">"local-address"</code> property</h3>
2722 <pre class="programlisting">  "local-address"            <a class="link" href="GSocketAddress.html" title="GSocketAddress"><span class="type">GSocketAddress</span></a>*       : Read</pre>
2723 <p>The local address the socket is bound to.</p>
2724 </div>
2725 <hr>
2726 <div class="refsect2">
2727 <a name="GSocket--multicast-loopback"></a><h3>The <code class="literal">"multicast-loopback"</code> property</h3>
2728 <pre class="programlisting">  "multicast-loopback"       <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>              : Read / Write</pre>
2729 <p>
2730 Whether outgoing multicast packets loop back to the local host.
2731 </p>
2732 <p>Default value: TRUE</p>
2733 <p class="since">Since 2.32</p>
2734 </div>
2735 <hr>
2736 <div class="refsect2">
2737 <a name="GSocket--multicast-ttl"></a><h3>The <code class="literal">"multicast-ttl"</code> property</h3>
2738 <pre class="programlisting">  "multicast-ttl"            <a href="./../glib/glib/glib-Basic-Types.html#guint"><span class="type">guint</span></a>                 : Read / Write</pre>
2739 <p>
2740 Time-to-live out outgoing multicast packets
2741 </p>
2742 <p>Default value: 1</p>
2743 <p class="since">Since 2.32</p>
2744 </div>
2745 <hr>
2746 <div class="refsect2">
2747 <a name="GSocket--protocol"></a><h3>The <code class="literal">"protocol"</code> property</h3>
2748 <pre class="programlisting">  "protocol"                 <a class="link" href="GSocket.html#GSocketProtocol" title="enum GSocketProtocol"><span class="type">GSocketProtocol</span></a>       : Read / Write / Construct Only</pre>
2749 <p>The id of the protocol to use, or -1 for unknown.</p>
2750 <p>Default value: G_SOCKET_PROTOCOL_UNKNOWN</p>
2751 </div>
2752 <hr>
2753 <div class="refsect2">
2754 <a name="GSocket--remote-address"></a><h3>The <code class="literal">"remote-address"</code> property</h3>
2755 <pre class="programlisting">  "remote-address"           <a class="link" href="GSocketAddress.html" title="GSocketAddress"><span class="type">GSocketAddress</span></a>*       : Read</pre>
2756 <p>The remote address the socket is connected to.</p>
2757 </div>
2758 <hr>
2759 <div class="refsect2">
2760 <a name="GSocket--timeout"></a><h3>The <code class="literal">"timeout"</code> property</h3>
2761 <pre class="programlisting">  "timeout"                  <a href="./../glib/glib/glib-Basic-Types.html#guint"><span class="type">guint</span></a>                 : Read / Write</pre>
2762 <p>
2763 The timeout in seconds on socket I/O
2764 </p>
2765 <p>Default value: 0</p>
2766 <p class="since">Since 2.26</p>
2767 </div>
2768 <hr>
2769 <div class="refsect2">
2770 <a name="GSocket--ttl"></a><h3>The <code class="literal">"ttl"</code> property</h3>
2771 <pre class="programlisting">  "ttl"                      <a href="./../glib/glib/glib-Basic-Types.html#guint"><span class="type">guint</span></a>                 : Read / Write</pre>
2772 <p>
2773 Time-to-live for outgoing unicast packets
2774 </p>
2775 <p>Default value: 0</p>
2776 <p class="since">Since 2.32</p>
2777 </div>
2778 <hr>
2779 <div class="refsect2">
2780 <a name="GSocket--type"></a><h3>The <code class="literal">"type"</code> property</h3>
2781 <pre class="programlisting">  "type"                     <a class="link" href="GSocket.html#GSocketType" title="enum GSocketType"><span class="type">GSocketType</span></a>           : Read / Write / Construct Only</pre>
2782 <p>The sockets type.</p>
2783 <p>Default value: G_SOCKET_TYPE_STREAM</p>
2784 </div>
2785 </div>
2786 <div class="refsect1">
2787 <a name="GSocket.see-also"></a><h2>See Also</h2>
2788 <a class="link" href="GInitable.html" title="GInitable"><span class="type">GInitable</span></a>
2789 </div>
2790 </div>
2791 <div class="footer">
2792 <hr>
2793           Generated by GTK-Doc V1.18</div>
2794 </body>
2795 </html>