source: appstream-generator/build/girepo/gio/SocketConnectableIF.d @ 4841

Last change on this file since 4841 was 4841, checked in by Juanma, 2 years ago

Initial release

File size: 3.4 KB
Line 
1/*
2 * Licensed under the GNU Lesser General Public License Version 3
3 *
4 * This library is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation, either version 3 of the license, or
7 * (at your option) any later version.
8 *
9 * This software is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this library.  If not, see <http://www.gnu.org/licenses/>.
16 */
17
18// generated automatically - do not change
19
20
21module gio.SocketConnectableIF;
22
23private import gi.gio;
24public  import gi.giotypes;
25private import gio.SocketAddressEnumerator;
26private import glib.Str;
27private import gobject.ObjectG;
28
29
30/**
31 * Objects that describe one or more potential socket endpoints
32 * implement #GSocketConnectable. Callers can then use
33 * g_socket_connectable_enumerate() to get a #GSocketAddressEnumerator
34 * to try out each socket address in turn until one succeeds, as shown
35 * in the sample code below.
36 *
37 * |[<!-- language="C" -->
38 * MyConnectionType *
39 * connect_to_host (const char    *hostname,
40 * guint16        port,
41 * GCancellable  *cancellable,
42 * GError       **error)
43 * {
44 * MyConnection *conn = NULL;
45 * GSocketConnectable *addr;
46 * GSocketAddressEnumerator *enumerator;
47 * GSocketAddress *sockaddr;
48 * GError *conn_error = NULL;
49 *
50 * addr = g_network_address_new (hostname, port);
51 * enumerator = g_socket_connectable_enumerate (addr);
52 * g_object_unref (addr);
53 *
54 * // Try each sockaddr until we succeed. Record the first connection error,
55 * // but not any further ones (since they'll probably be basically the same
56 * // as the first).
57 * while (!conn && (sockaddr = g_socket_address_enumerator_next (enumerator, cancellable, error))
58 * {
59 * conn = connect_to_sockaddr (sockaddr, conn_error ? NULL : &conn_error);
60 * g_object_unref (sockaddr);
61 * }
62 * g_object_unref (enumerator);
63 *
64 * if (conn)
65 * {
66 * if (conn_error)
67 * {
68 * // We couldn't connect to the first address, but we succeeded
69 * // in connecting to a later address.
70 * g_error_free (conn_error);
71 * }
72 * return conn;
73 * }
74 * else if (error)
75 * {
76 * /// Either initial lookup failed, or else the caller cancelled us.
77 * if (conn_error)
78 * g_error_free (conn_error);
79 * return NULL;
80 * }
81 * else
82 * {
83 * g_error_propagate (error, conn_error);
84 * return NULL;
85 * }
86 * }
87 * ]|
88 */
89public interface SocketConnectableIF{
90        /** Get the main Gtk struct */
91        public GSocketConnectable* getSocketConnectableStruct();
92
93        /** the main Gtk struct as a void* */
94        protected void* getStruct();
95
96
97        /**
98         * Creates a #GSocketAddressEnumerator for @connectable.
99         *
100         * Returns: a new #GSocketAddressEnumerator.
101         *
102         * Since: 2.22
103         */
104        public SocketAddressEnumerator enumerate();
105
106        /**
107         * Creates a #GSocketAddressEnumerator for @connectable that will
108         * return #GProxyAddresses for addresses that you must connect
109         * to via a proxy.
110         *
111         * If @connectable does not implement
112         * g_socket_connectable_proxy_enumerate(), this will fall back to
113         * calling g_socket_connectable_enumerate().
114         *
115         * Returns: a new #GSocketAddressEnumerator.
116         *
117         * Since: 2.26
118         */
119        public SocketAddressEnumerator proxyEnumerate();
120
121        /** */
122        public string toString();
123}
Note: See TracBrowser for help on using the repository browser.