blob: 7d5e738a274340a32080cb7f5aacc405015fbf34 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>GSocketConnectable: GIO Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="index.html" title="GIO Reference Manual">
<link rel="up" href="resolver.html" title="DNS resolution">
<link rel="prev" href="GSimpleProxyResolver.html" title="GSimpleProxyResolver">
<link rel="next" href="GNetworkAddress.html" title="GNetworkAddress">
<meta name="generator" content="GTK-Doc V1.25.1 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts">
<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
<a href="#GSocketConnectable.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
<a href="#GSocketConnectable.object-hierarchy" class="shortcut">Object Hierarchy</a></span><span id="nav_prerequisites">  <span class="dim">|</span> 
<a href="#GSocketConnectable.prerequisites" class="shortcut">Prerequisites</a></span><span id="nav_implementations">  <span class="dim">|</span> 
<a href="#GSocketConnectable.implementations" class="shortcut">Known Implementations</a></span><span id="nav_properties">  <span class="dim">|</span> 
<a href="#GSocketConnectable.properties" class="shortcut">Properties</a></span>
</td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="resolver.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="GSimpleProxyResolver.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="GNetworkAddress.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="GSocketConnectable"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="GSocketConnectable.top_of_page"></a>GSocketConnectable</span></h2>
<p>GSocketConnectable — Interface for potential socket endpoints</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="GSocketConnectable.functions"></a><h2>Functions</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="functions_return">
<col class="functions_name">
</colgroup>
<tbody>
<tr>
<td class="function_type">
<a class="link" href="GSocketConnectable.html#GSocketAddressEnumerator"><span class="returnvalue">GSocketAddressEnumerator</span></a> *
</td>
<td class="function_name">
<a class="link" href="GSocketConnectable.html#g-socket-connectable-enumerate" title="g_socket_connectable_enumerate ()">g_socket_connectable_enumerate</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="GSocketConnectable.html#GSocketAddressEnumerator"><span class="returnvalue">GSocketAddressEnumerator</span></a> *
</td>
<td class="function_name">
<a class="link" href="GSocketConnectable.html#g-socket-connectable-proxy-enumerate" title="g_socket_connectable_proxy_enumerate ()">g_socket_connectable_proxy_enumerate</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="../glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="GSocketConnectable.html#g-socket-connectable-to-string" title="g_socket_connectable_to_string ()">g_socket_connectable_to_string</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="GSocketAddress.html" title="GSocketAddress"><span class="returnvalue">GSocketAddress</span></a> *
</td>
<td class="function_name">
<a class="link" href="GSocketConnectable.html#g-socket-address-enumerator-next" title="g_socket_address_enumerator_next ()">g_socket_address_enumerator_next</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="GSocketConnectable.html#g-socket-address-enumerator-next-async" title="g_socket_address_enumerator_next_async ()">g_socket_address_enumerator_next_async</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="GSocketAddress.html" title="GSocketAddress"><span class="returnvalue">GSocketAddress</span></a> *
</td>
<td class="function_name">
<a class="link" href="GSocketConnectable.html#g-socket-address-enumerator-next-finish" title="g_socket_address_enumerator_next_finish ()">g_socket_address_enumerator_next_finish</a> <span class="c_punctuation">()</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="GSocketConnectable.properties"></a><h2>Properties</h2>
<div class="informaltable"><table class="informaltable" border="0">
<colgroup>
<col width="150px" class="properties_type">
<col width="300px" class="properties_name">
<col width="200px" class="properties_flags">
</colgroup>
<tbody>
<tr>
<td class="property_type">
<a class="link" href="GSocketConnectable.html" title="GSocketConnectable"><span class="type">GSocketConnectable</span></a> *</td>
<td class="property_name"><a class="link" href="GSocketConnectable.html#GProxyAddressEnumerator--connectable" title="The “connectable” property">connectable</a></td>
<td class="property_flags">Read / Write / Construct Only</td>
</tr>
<tr>
<td class="property_type"><a href="../glib-Basic-Types.html#guint"><span class="type">guint</span></a></td>
<td class="property_name"><a class="link" href="GSocketConnectable.html#GProxyAddressEnumerator--default-port" title="The “default-port” property">default-port</a></td>
<td class="property_flags">Read / Write / Construct Only</td>
</tr>
<tr>
<td class="property_type">
<a class="link" href="GProxyResolver.html" title="GProxyResolver"><span class="type">GProxyResolver</span></a> *</td>
<td class="property_name"><a class="link" href="GSocketConnectable.html#GProxyAddressEnumerator--proxy-resolver" title="The “proxy-resolver” property">proxy-resolver</a></td>
<td class="property_flags">Read / Write / Construct</td>
</tr>
<tr>
<td class="property_type">
<a href="../glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *</td>
<td class="property_name"><a class="link" href="GSocketConnectable.html#GProxyAddressEnumerator--uri" title="The “uri” property">uri</a></td>
<td class="property_flags">Read / Write / Construct Only</td>
</tr>
</tbody>
</table></div>
</div>
<a name="GSocketAddressEnumerator"></a><a name="GProxyAddressEnumerator"></a><div class="refsect1">
<a name="GSocketConnectable.other"></a><h2>Types and Values</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="name">
<col class="description">
</colgroup>
<tbody>
<tr>
<td class="datatype_keyword"> </td>
<td class="function_name"><a class="link" href="GSocketConnectable.html#GSocketConnectable-struct" title="GSocketConnectable">GSocketConnectable</a></td>
</tr>
<tr>
<td class="datatype_keyword">struct</td>
<td class="function_name"><a class="link" href="GSocketConnectable.html#GSocketConnectableIface" title="struct GSocketConnectableIface">GSocketConnectableIface</a></td>
</tr>
<tr>
<td class="datatype_keyword"> </td>
<td class="function_name"><a class="link" href="GSocketConnectable.html#GSocketAddressEnumerator-struct" title="GSocketAddressEnumerator">GSocketAddressEnumerator</a></td>
</tr>
<tr>
<td class="datatype_keyword"> </td>
<td class="function_name"><a class="link" href="GSocketConnectable.html#GProxyAddressEnumerator-struct" title="GProxyAddressEnumerator">GProxyAddressEnumerator</a></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="GSocketConnectable.object-hierarchy"></a><h2>Object Hierarchy</h2>
<pre class="screen"> <a href="https://developer.gnome.org/gobject/unstable/GTypeModule.html">GInterface</a>
<span class="lineart">╰──</span> GSocketConnectable
<a href="../gobject-The-Base-Object-Type.html#GObject-struct">GObject</a>
<span class="lineart">╰──</span> GSocketAddressEnumerator
<span class="lineart">╰──</span> GProxyAddressEnumerator
</pre>
</div>
<div class="refsect1">
<a name="GSocketConnectable.prerequisites"></a><h2>Prerequisites</h2>
<p>
GSocketConnectable requires
<a href="../gobject-The-Base-Object-Type.html#GObject-struct">GObject</a>.</p>
</div>
<div class="refsect1">
<a name="GSocketConnectable.implementations"></a><h2>Known Implementations</h2>
<p>
GSocketConnectable is implemented by
<a class="link" href="GInetSocketAddress.html" title="GInetSocketAddress">GInetSocketAddress</a>, <a class="link" href="GNetworkAddress.html" title="GNetworkAddress">GNetworkAddress</a>, <a class="link" href="GNetworkService.html" title="GNetworkService">GNetworkService</a>, <a class="link" href="GProxyAddress.html" title="GProxyAddress">GProxyAddress</a>, <a class="link" href="GSocketAddress.html" title="GSocketAddress">GSocketAddress</a> and <a class="link" href="GUnixSocketAddress.html" title="GUnixSocketAddress">GUnixSocketAddress</a>.</p>
</div>
<div class="refsect1">
<a name="GSocketConnectable.includes"></a><h2>Includes</h2>
<pre class="synopsis">#include &lt;gio/gio.h&gt;
</pre>
</div>
<div class="refsect1">
<a name="GSocketConnectable.description"></a><h2>Description</h2>
<p>Objects that describe one or more potential socket endpoints
implement <a class="link" href="GSocketConnectable.html" title="GSocketConnectable"><span class="type">GSocketConnectable</span></a>. Callers can then use
<a class="link" href="GSocketConnectable.html#g-socket-connectable-enumerate" title="g_socket_connectable_enumerate ()"><code class="function">g_socket_connectable_enumerate()</code></a> to get a <a class="link" href="GSocketConnectable.html#GSocketAddressEnumerator"><span class="type">GSocketAddressEnumerator</span></a>
to try out each socket address in turn until one succeeds, as shown
in the sample code below.</p>
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49</pre></td>
<td class="listing_code"><pre class="programlisting"><span class="normal">MyConnectionType </span><span class="symbol">*</span>
<span class="function">connect_to_host</span><span class="normal"> </span><span class="symbol">(</span><span class="keyword">const</span><span class="normal"> </span><span class="type">char</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">hostname</span><span class="symbol">,</span>
<span class="normal"> </span><span class="usertype">guint16</span><span class="normal"> port</span><span class="symbol">,</span>
<span class="normal"> </span><span class="usertype">GCancellable</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">cancellable</span><span class="symbol">,</span>
<span class="normal"> </span><span class="usertype">GError</span><span class="normal"> </span><span class="symbol">**</span><span class="normal">error</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal"> </span><span class="usertype">MyConnection</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">conn </span><span class="symbol">=</span><span class="normal"> <a href="../glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>
<span class="normal"> </span><span class="usertype">GSocketConnectable</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">addr</span><span class="symbol">;</span>
<span class="normal"> </span><span class="usertype">GSocketAddressEnumerator</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">enumerator</span><span class="symbol">;</span>
<span class="normal"> </span><span class="usertype">GSocketAddress</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">sockaddr</span><span class="symbol">;</span>
<span class="normal"> </span><span class="usertype">GError</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">conn_error </span><span class="symbol">=</span><span class="normal"> <a href="../glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>
<span class="normal"> addr </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GNetworkAddress.html#g-network-address-new">g_network_address_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">hostname</span><span class="symbol">,</span><span class="normal"> port</span><span class="symbol">);</span>
<span class="normal"> enumerator </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GSocketConnectable.html#g-socket-connectable-enumerate">g_socket_connectable_enumerate</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">addr</span><span class="symbol">);</span>
<span class="normal"> </span><span class="function"><a href="../gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">addr</span><span class="symbol">);</span>
<span class="normal"> </span><span class="comment">// Try each sockaddr until we succeed. Record the first connection error,</span>
<span class="normal"> </span><span class="comment">// but not any further ones (since they'll probably be basically the same</span>
<span class="normal"> </span><span class="comment">// as the first).</span>
<span class="normal"> </span><span class="keyword">while</span><span class="normal"> </span><span class="symbol">(!</span><span class="normal">conn </span><span class="symbol">&amp;&amp;</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">sockaddr </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GSocketConnectable.html#g-socket-address-enumerator-next">g_socket_address_enumerator_next</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">enumerator</span><span class="symbol">,</span><span class="normal"> cancellable</span><span class="symbol">,</span><span class="normal"> error</span><span class="symbol">))</span>
<span class="normal"> </span><span class="cbracket">{</span>
<span class="normal"> conn </span><span class="symbol">=</span><span class="normal"> </span><span class="function">connect_to_sockaddr</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">sockaddr</span><span class="symbol">,</span><span class="normal"> conn_error </span><span class="symbol">?</span><span class="normal"> <a href="../glib-Standard-Macros.html#NULL:CAPS">NULL</a> </span><span class="symbol">:</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">conn_error</span><span class="symbol">);</span>
<span class="normal"> </span><span class="function"><a href="../gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">sockaddr</span><span class="symbol">);</span>
<span class="normal"> </span><span class="cbracket">}</span>
<span class="normal"> </span><span class="function"><a href="../gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">enumerator</span><span class="symbol">);</span>
<span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">conn</span><span class="symbol">)</span>
<span class="normal"> </span><span class="cbracket">{</span>
<span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">conn_error</span><span class="symbol">)</span>
<span class="normal"> </span><span class="cbracket">{</span>
<span class="normal"> </span><span class="comment">// We couldn't connect to the first address, but we succeeded</span>
<span class="normal"> </span><span class="comment">// in connecting to a later address.</span>
<span class="normal"> </span><span class="function"><a href="../glib-Error-Reporting.html#g-error-free">g_error_free</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">conn_error</span><span class="symbol">);</span>
<span class="normal"> </span><span class="cbracket">}</span>
<span class="normal"> </span><span class="keyword">return</span><span class="normal"> conn</span><span class="symbol">;</span>
<span class="normal"> </span><span class="cbracket">}</span>
<span class="normal"> </span><span class="keyword">else</span><span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">error</span><span class="symbol">)</span>
<span class="normal"> </span><span class="cbracket">{</span>
<span class="normal"> </span><span class="comment">/// Either initial lookup failed, or else the caller cancelled us.</span>
<span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">conn_error</span><span class="symbol">)</span>
<span class="normal"> </span><span class="function"><a href="../glib-Error-Reporting.html#g-error-free">g_error_free</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">conn_error</span><span class="symbol">);</span>
<span class="normal"> </span><span class="keyword">return</span><span class="normal"> <a href="../glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>
<span class="normal"> </span><span class="cbracket">}</span>
<span class="normal"> </span><span class="keyword">else</span>
<span class="normal"> </span><span class="cbracket">{</span>
<span class="normal"> </span><span class="function">g_error_propagate</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">error</span><span class="symbol">,</span><span class="normal"> conn_error</span><span class="symbol">);</span>
<span class="normal"> </span><span class="keyword">return</span><span class="normal"> <a href="../glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>
<span class="normal"> </span><span class="cbracket">}</span>
<span class="cbracket">}</span></pre></td>
</tr>
</tbody>
</table>
</div>
<p></p>
</div>
<div class="refsect1">
<a name="GSocketConnectable.functions_details"></a><h2>Functions</h2>
<div class="refsect2">
<a name="g-socket-connectable-enumerate"></a><h3>g_socket_connectable_enumerate ()</h3>
<pre class="programlisting"><a class="link" href="GSocketConnectable.html#GSocketAddressEnumerator"><span class="returnvalue">GSocketAddressEnumerator</span></a> *
g_socket_connectable_enumerate (<em class="parameter"><code><a class="link" href="GSocketConnectable.html" title="GSocketConnectable"><span class="type">GSocketConnectable</span></a> *connectable</code></em>);</pre>
<p>Creates a <a class="link" href="GSocketConnectable.html#GSocketAddressEnumerator"><span class="type">GSocketAddressEnumerator</span></a> for <em class="parameter"><code>connectable</code></em>
.</p>
<div class="refsect3">
<a name="g-socket-connectable-enumerate.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>connectable</p></td>
<td class="parameter_description"><p>a <a class="link" href="GSocketConnectable.html" title="GSocketConnectable"><span class="type">GSocketConnectable</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-socket-connectable-enumerate.returns"></a><h4>Returns</h4>
<p> a new <a class="link" href="GSocketConnectable.html#GSocketAddressEnumerator"><span class="type">GSocketAddressEnumerator</span></a>. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-22.html#api-index-2.22">2.22</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-socket-connectable-proxy-enumerate"></a><h3>g_socket_connectable_proxy_enumerate ()</h3>
<pre class="programlisting"><a class="link" href="GSocketConnectable.html#GSocketAddressEnumerator"><span class="returnvalue">GSocketAddressEnumerator</span></a> *
g_socket_connectable_proxy_enumerate (<em class="parameter"><code><a class="link" href="GSocketConnectable.html" title="GSocketConnectable"><span class="type">GSocketConnectable</span></a> *connectable</code></em>);</pre>
<p>Creates a <a class="link" href="GSocketConnectable.html#GSocketAddressEnumerator"><span class="type">GSocketAddressEnumerator</span></a> for <em class="parameter"><code>connectable</code></em>
that will
return <span class="type">GProxyAddresses</span> for addresses that you must connect
to via a proxy.</p>
<p>If <em class="parameter"><code>connectable</code></em>
does not implement
<a class="link" href="GSocketConnectable.html#g-socket-connectable-proxy-enumerate" title="g_socket_connectable_proxy_enumerate ()"><code class="function">g_socket_connectable_proxy_enumerate()</code></a>, this will fall back to
calling <a class="link" href="GSocketConnectable.html#g-socket-connectable-enumerate" title="g_socket_connectable_enumerate ()"><code class="function">g_socket_connectable_enumerate()</code></a>.</p>
<div class="refsect3">
<a name="g-socket-connectable-proxy-enumerate.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>connectable</p></td>
<td class="parameter_description"><p>a <a class="link" href="GSocketConnectable.html" title="GSocketConnectable"><span class="type">GSocketConnectable</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-socket-connectable-proxy-enumerate.returns"></a><h4>Returns</h4>
<p> a new <a class="link" href="GSocketConnectable.html#GSocketAddressEnumerator"><span class="type">GSocketAddressEnumerator</span></a>. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-26.html#api-index-2.26">2.26</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-socket-connectable-to-string"></a><h3>g_socket_connectable_to_string ()</h3>
<pre class="programlisting"><a href="../glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *
g_socket_connectable_to_string (<em class="parameter"><code><a class="link" href="GSocketConnectable.html" title="GSocketConnectable"><span class="type">GSocketConnectable</span></a> *connectable</code></em>);</pre>
<p>Format a <a class="link" href="GSocketConnectable.html" title="GSocketConnectable"><span class="type">GSocketConnectable</span></a> as a string. This is a human-readable format for
use in debugging output, and is not a stable serialization format. It is not
suitable for use in user interfaces as it exposes too much information for a
user.</p>
<p>If the <a class="link" href="GSocketConnectable.html" title="GSocketConnectable"><span class="type">GSocketConnectable</span></a> implementation does not support string formatting,
the implementation’s type name will be returned as a fallback.</p>
<div class="refsect3">
<a name="g-socket-connectable-to-string.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>connectable</p></td>
<td class="parameter_description"><p>a <a class="link" href="GSocketConnectable.html" title="GSocketConnectable"><span class="type">GSocketConnectable</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-socket-connectable-to-string.returns"></a><h4>Returns</h4>
<p> the formatted string. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-48.html#api-index-2.48">2.48</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-socket-address-enumerator-next"></a><h3>g_socket_address_enumerator_next ()</h3>
<pre class="programlisting"><a class="link" href="GSocketAddress.html" title="GSocketAddress"><span class="returnvalue">GSocketAddress</span></a> *
g_socket_address_enumerator_next (<em class="parameter"><code><a class="link" href="GSocketConnectable.html#GSocketAddressEnumerator"><span class="type">GSocketAddressEnumerator</span></a> *enumerator</code></em>,
<em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
<em class="parameter"><code><a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>Retrieves the next <a class="link" href="GSocketAddress.html" title="GSocketAddress"><span class="type">GSocketAddress</span></a> from <em class="parameter"><code>enumerator</code></em>
. Note that this
may block for some amount of time. (Eg, a <a class="link" href="GNetworkAddress.html" title="GNetworkAddress"><span class="type">GNetworkAddress</span></a> may need
to do a DNS lookup before it can return an address.) Use
<a class="link" href="GSocketConnectable.html#g-socket-address-enumerator-next-async" title="g_socket_address_enumerator_next_async ()"><code class="function">g_socket_address_enumerator_next_async()</code></a> if you need to avoid
blocking.</p>
<p>If <em class="parameter"><code>enumerator</code></em>
is expected to yield addresses, but for some reason
is unable to (eg, because of a DNS error), then the first call to
<a class="link" href="GSocketConnectable.html#g-socket-address-enumerator-next" title="g_socket_address_enumerator_next ()"><code class="function">g_socket_address_enumerator_next()</code></a> will return an appropriate error
in *<em class="parameter"><code>error</code></em>
. However, if the first call to
<a class="link" href="GSocketConnectable.html#g-socket-address-enumerator-next" title="g_socket_address_enumerator_next ()"><code class="function">g_socket_address_enumerator_next()</code></a> succeeds, then any further
internal errors (other than <em class="parameter"><code>cancellable</code></em>
being triggered) will be
ignored.</p>
<div class="refsect3">
<a name="g-socket-address-enumerator-next.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>enumerator</p></td>
<td class="parameter_description"><p>a <a class="link" href="GSocketConnectable.html#GSocketAddressEnumerator"><span class="type">GSocketAddressEnumerator</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>cancellable</p></td>
<td class="parameter_description"><p> optional <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> object, <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>a <a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a>.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-socket-address-enumerator-next.returns"></a><h4>Returns</h4>
<p> a <a class="link" href="GSocketAddress.html" title="GSocketAddress"><span class="type">GSocketAddress</span></a> (owned by the caller), or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on
error (in which case *<em class="parameter"><code>error</code></em>
will be set) or if there are no
more addresses. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-socket-address-enumerator-next-async"></a><h3>g_socket_address_enumerator_next_async ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_socket_address_enumerator_next_async
(<em class="parameter"><code><a class="link" href="GSocketConnectable.html#GSocketAddressEnumerator"><span class="type">GSocketAddressEnumerator</span></a> *enumerator</code></em>,
<em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
<em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>,
<em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
<p>Asynchronously retrieves the next <a class="link" href="GSocketAddress.html" title="GSocketAddress"><span class="type">GSocketAddress</span></a> from <em class="parameter"><code>enumerator</code></em>
and then calls <em class="parameter"><code>callback</code></em>
, which must call
<a class="link" href="GSocketConnectable.html#g-socket-address-enumerator-next-finish" title="g_socket_address_enumerator_next_finish ()"><code class="function">g_socket_address_enumerator_next_finish()</code></a> to get the result.</p>
<div class="refsect3">
<a name="g-socket-address-enumerator-next-async.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>enumerator</p></td>
<td class="parameter_description"><p>a <a class="link" href="GSocketConnectable.html#GSocketAddressEnumerator"><span class="type">GSocketAddressEnumerator</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>cancellable</p></td>
<td class="parameter_description"><p> optional <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> object, <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>callback</p></td>
<td class="parameter_description"><p> a <a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> to call when the request
is satisfied. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="The callback is valid until first called."><span class="acronym">scope async</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>user_data</p></td>
<td class="parameter_description"><p> the data to pass to callback function. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="This parameter is a 'user_data', for callbacks; many bindings can pass NULL here."><span class="acronym">closure</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-socket-address-enumerator-next-finish"></a><h3>g_socket_address_enumerator_next_finish ()</h3>
<pre class="programlisting"><a class="link" href="GSocketAddress.html" title="GSocketAddress"><span class="returnvalue">GSocketAddress</span></a> *
g_socket_address_enumerator_next_finish
(<em class="parameter"><code><a class="link" href="GSocketConnectable.html#GSocketAddressEnumerator"><span class="type">GSocketAddressEnumerator</span></a> *enumerator</code></em>,
<em class="parameter"><code><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *result</code></em>,
<em class="parameter"><code><a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>Retrieves the result of a completed call to
<a class="link" href="GSocketConnectable.html#g-socket-address-enumerator-next-async" title="g_socket_address_enumerator_next_async ()"><code class="function">g_socket_address_enumerator_next_async()</code></a>. See
<a class="link" href="GSocketConnectable.html#g-socket-address-enumerator-next" title="g_socket_address_enumerator_next ()"><code class="function">g_socket_address_enumerator_next()</code></a> for more information about
error handling.</p>
<div class="refsect3">
<a name="g-socket-address-enumerator-next-finish.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>enumerator</p></td>
<td class="parameter_description"><p>a <a class="link" href="GSocketConnectable.html#GSocketAddressEnumerator"><span class="type">GSocketAddressEnumerator</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>result</p></td>
<td class="parameter_description"><p>a <a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>a <a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-socket-address-enumerator-next-finish.returns"></a><h4>Returns</h4>
<p> a <a class="link" href="GSocketAddress.html" title="GSocketAddress"><span class="type">GSocketAddress</span></a> (owned by the caller), or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on
error (in which case *<em class="parameter"><code>error</code></em>
will be set) or if there are no
more addresses. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
</div>
</div>
<div class="refsect1">
<a name="GSocketConnectable.other_details"></a><h2>Types and Values</h2>
<div class="refsect2">
<a name="GSocketConnectable-struct"></a><h3>GSocketConnectable</h3>
<pre class="programlisting">typedef struct _GSocketConnectable GSocketConnectable;</pre>
<p>Interface for objects that contain or generate <a class="link" href="GSocketAddress.html" title="GSocketAddress"><span class="type">GSocketAddress</span></a>&lt;!-- --&gt;es.</p>
</div>
<hr>
<div class="refsect2">
<a name="GSocketConnectableIface"></a><h3>struct GSocketConnectableIface</h3>
<pre class="programlisting">struct GSocketConnectableIface {
GTypeInterface g_iface;
/* Virtual Table */
GSocketAddressEnumerator * (* enumerate) (GSocketConnectable *connectable);
GSocketAddressEnumerator * (* proxy_enumerate) (GSocketConnectable *connectable);
gchar * (* to_string) (GSocketConnectable *connectable);
};
</pre>
<p>Provides an interface for returning a <a class="link" href="GSocketConnectable.html#GSocketAddressEnumerator"><span class="type">GSocketAddressEnumerator</span></a>
and <a class="link" href="GSocketConnectable.html#GProxyAddressEnumerator"><span class="type">GProxyAddressEnumerator</span></a></p>
<div class="refsect3">
<a name="GSocketConnectableIface.members"></a><h4>Members</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="300px" class="struct_members_name">
<col class="struct_members_description">
<col width="200px" class="struct_members_annotations">
</colgroup>
<tbody>
<tr>
<td class="struct_member_name"><p><em class="structfield"><code><a name="GSocketConnectableIface.enumerate"></a>enumerate</code></em> ()</p></td>
<td class="struct_member_description"><p>Creates a <a class="link" href="GSocketConnectable.html#GSocketAddressEnumerator"><span class="type">GSocketAddressEnumerator</span></a></p></td>
<td class="struct_member_annotations"> </td>
</tr>
<tr>
<td class="struct_member_name"><p><em class="structfield"><code><a name="GSocketConnectableIface.proxy-enumerate"></a>proxy_enumerate</code></em> ()</p></td>
<td class="struct_member_description"><p>Creates a <a class="link" href="GSocketConnectable.html#GProxyAddressEnumerator"><span class="type">GProxyAddressEnumerator</span></a></p></td>
<td class="struct_member_annotations"> </td>
</tr>
<tr>
<td class="struct_member_name"><p><em class="structfield"><code><a name="GSocketConnectableIface.to-string"></a>to_string</code></em> ()</p></td>
<td class="struct_member_description"><p>Format the connectable’s address as a string for debugging.
Implementing this is optional. (Since: 2.48)</p></td>
<td class="struct_member_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="GSocketAddressEnumerator-struct"></a><h3>GSocketAddressEnumerator</h3>
<pre class="programlisting">typedef struct _GSocketAddressEnumerator GSocketAddressEnumerator;</pre>
<p>Enumerator type for objects that contain or generate
<a class="link" href="GSocketAddress.html" title="GSocketAddress"><span class="type">GSocketAddress</span></a>&lt;!-- --&gt;es.</p>
</div>
<hr>
<div class="refsect2">
<a name="GProxyAddressEnumerator-struct"></a><h3>GProxyAddressEnumerator</h3>
<pre class="programlisting">typedef struct _GProxyAddressEnumerator GProxyAddressEnumerator;</pre>
<p>A subclass of <a class="link" href="GSocketConnectable.html#GSocketAddressEnumerator"><span class="type">GSocketAddressEnumerator</span></a> that takes another address
enumerator and wraps its results in <a class="link" href="GProxyAddress.html" title="GProxyAddress"><span class="type">GProxyAddress</span></a>&lt;!-- --&gt;es as
directed by the default <a class="link" href="GProxyResolver.html" title="GProxyResolver"><span class="type">GProxyResolver</span></a>.</p>
</div>
</div>
<div class="refsect1">
<a name="GSocketConnectable.property-details"></a><h2>Property Details</h2>
<div class="refsect2">
<a name="GProxyAddressEnumerator--connectable"></a><h3>The <code class="literal">“connectable”</code> property</h3>
<pre class="programlisting"> “connectable” <a class="link" href="GSocketConnectable.html" title="GSocketConnectable"><span class="type">GSocketConnectable</span></a> *</pre>
<p>The connectable being enumerated.</p>
<p>Flags: Read / Write / Construct Only</p>
</div>
<hr>
<div class="refsect2">
<a name="GProxyAddressEnumerator--default-port"></a><h3>The <code class="literal">“default-port”</code> property</h3>
<pre class="programlisting"> “default-port” <a href="../glib-Basic-Types.html#guint"><span class="type">guint</span></a></pre>
<p>The default port to use if <a class="link" href="GSocketConnectable.html#GProxyAddressEnumerator--uri" title="The “uri” property"><span class="type">“uri”</span></a> does not
specify one.</p>
<p>Flags: Read / Write / Construct Only</p>
<p>Allowed values: &lt;= 65535</p>
<p>Default value: 0</p>
<p class="since">Since: <a class="link" href="api-index-2-38.html#api-index-2.38">2.38</a></p>
</div>
<hr>
<div class="refsect2">
<a name="GProxyAddressEnumerator--proxy-resolver"></a><h3>The <code class="literal">“proxy-resolver”</code> property</h3>
<pre class="programlisting"> “proxy-resolver” <a class="link" href="GProxyResolver.html" title="GProxyResolver"><span class="type">GProxyResolver</span></a> *</pre>
<p>The proxy resolver to use.</p>
<p>Flags: Read / Write / Construct</p>
<p class="since">Since: <a class="link" href="api-index-2-36.html#api-index-2.36">2.36</a></p>
</div>
<hr>
<div class="refsect2">
<a name="GProxyAddressEnumerator--uri"></a><h3>The <code class="literal">“uri”</code> property</h3>
<pre class="programlisting"> “uri” <a href="../glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *</pre>
<p>The destination URI, use none:// for generic socket.</p>
<p>Flags: Read / Write / Construct Only</p>
<p>Default value: NULL</p>
</div>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.25.1</div>
</body>
</html>