glibmm: Gio::SocketClient Class Reference
Helper for connecting to a network service. More...
#include <giomm/socketclient.h>
Public Member Functions | |
virtual | ~SocketClient () |
GSocketClient* | gobj () |
Provides access to the underlying C GObject. | |
const GSocketClient* | gobj () const |
Provides access to the underlying C GObject. | |
GSocketClient* | gobj_copy () |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. | |
SocketFamily | get_family () const |
Gets the socket family of the socket client. | |
void | set_family (SocketFamily family) |
Sets the socket family of the socket client. | |
SocketType | get_socket_type () const |
Gets the socket type of the socket client. | |
void | set_socket_type (SocketType type) |
Sets the socket type of the socket client. | |
SocketProtocol | get_protocol () const |
Gets the protocol name type of the socket client. | |
void | set_protocol (SocketProtocol protocol) |
Sets the protocol of the socket client. | |
Glib::RefPtr< SocketAddress > | get_local_address () |
Gets the local address of the socket client. | |
Glib::RefPtr< const SocketAddress > | get_local_address () const |
Gets the local address of the socket client. | |
void | set_local_address (const Glib::RefPtr< SocketAddress >& address) |
Sets the local address of the socket client. | |
Glib::RefPtr< SocketConnection > | connect (const Glib::RefPtr< SocketConnectable >& connectable, const Glib::RefPtr< Cancellable >& cancellable) |
Tries to resolve the connectable and make a network connection to it. | |
Glib::RefPtr< SocketConnection > | connect (const Glib::RefPtr< SocketConnectable >& connectable) |
Glib::RefPtr< SocketConnection > | connect_to_host (const Glib::ustring& host_and_port, guint16 default_port, const Glib::RefPtr< Cancellable >& cancellable) |
This is a helper function for g_socket_client_connect(). | |
Glib::RefPtr< SocketConnection > | connect_to_host (const Glib::ustring& host_and_port, guint16 default_port) |
This is a helper function for connect(). | |
Glib::RefPtr< SocketConnection > | connect_to_service (const Glib::ustring& domain, const Glib::ustring& service, const Glib::RefPtr< Cancellable >& cancellable) |
Attempts to create a TCP connection to a service. | |
Glib::RefPtr< SocketConnection > | connect_to_service (const Glib::ustring& domain, const Glib::ustring& service) |
Glib::RefPtr< SocketConnection > | connect_to_uri (const Glib::ustring& uri, guint16 default_port, const Glib::RefPtr< Cancellable >& cancellable) |
This is a helper function for g_socket_client_connect(). | |
Glib::RefPtr< SocketConnection > | connect_to_uri (const Glib::ustring& uri, guint16 default_port) |
This is a helper function for connect(). | |
void | connect_async (const Glib::RefPtr< SocketConnectable >& connectable, const Glib::RefPtr< Cancellable >& cancellable, const SlotAsyncReady& slot) |
This is the asynchronous version of g_socket_client_connect(). | |
void | connect_async (const Glib::RefPtr< SocketConnectable >& connectable, const SlotAsyncReady& slot) |
This is the asynchronous version of connect(). | |
Glib::RefPtr< SocketConnection > | connect_finish (const Glib::RefPtr< AsyncResult >& result) |
Finishes an async connect operation. | |
void | connect_to_host_async (const Glib::ustring& host_and_port, guint16 default_port, const Glib::RefPtr< Cancellable >& cancellable, const SlotAsyncReady& slot) |
This is the asynchronous version of g_socket_client_connect_to_host(). | |
void | connect_to_host_async (const Glib::ustring& host_and_port, guint16 default_port, const SlotAsyncReady& slot) |
This is the asynchronous version of connect_to_host(). | |
Glib::RefPtr< SocketConnection > | connect_to_host_finish (const Glib::RefPtr< AsyncResult >& result) |
Finishes an async connect operation. | |
void | connect_to_service_async (const Glib::ustring& domain, const Glib::ustring& service, const Glib::RefPtr< Cancellable >& cancellable, const SlotAsyncReady& slot) |
This is the asynchronous version of g_socket_client_connect_to_service(). | |
void | connect_to_service_async (const Glib::ustring& domain, const Glib::ustring& service, const SlotAsyncReady& slot) |
This is the asynchronous version of connect_to_service(). | |
Glib::RefPtr< SocketConnection > | connect_to_service_finish (const Glib::RefPtr< AsyncResult >& result) |
Finishes an async connect operation. | |
void | connect_to_uri_async (const Glib::ustring& uri, guint16 default_port, const Glib::RefPtr< Cancellable >& cancellable, const SlotAsyncReady& slot) |
This is the asynchronous version of g_socket_client_connect_to_uri(). | |
void | connect_to_uri_async (const Glib::ustring& uri, guint16 default_port, const SlotAsyncReady& slot) |
This is the asynchronous version of connect_to_uri(). | |
Glib::RefPtr< SocketConnection > | connect_to_uri_finish (const Glib::RefPtr< AsyncResult >& result) |
Finishes an async connect operation. | |
bool | get_enable_proxy () const |
Gets the proxy enable state; see g_socket_client_set_enable_proxy() | |
void | set_enable_proxy (bool enable) |
Sets whether or not client attempts to make connections via a proxy server. | |
guint | get_timeout () const |
Gets the I/O timeout time for sockets created by client. | |
void | set_timeout (guint enable) |
Sets the I/O timeout for sockets created by client. | |
void | add_application_proxy (const Glib::ustring& protocol) |
Enable proxy protocols to be handled by the application. | |
Glib::PropertyProxy< SocketFamily > | property_family () |
The sockets address family to use for socket construction. | |
Glib::PropertyProxy_ReadOnly < SocketFamily > | property_family () const |
The sockets address family to use for socket construction. | |
Glib::PropertyProxy < Glib::RefPtr< SocketAddress > > | property_local_address () |
The local address constructed sockets will be bound to. | |
Glib::PropertyProxy_ReadOnly < Glib::RefPtr< SocketAddress > > | property_local_address () const |
The local address constructed sockets will be bound to. | |
Glib::PropertyProxy < SocketProtocol > | property_protocol () |
The protocol to use for socket construction, or 0 for default. | |
Glib::PropertyProxy_ReadOnly < SocketProtocol > | property_protocol () const |
The protocol to use for socket construction, or 0 for default. | |
Glib::PropertyProxy< SocketType > | property_type () |
The sockets type to use for socket construction. | |
Glib::PropertyProxy_ReadOnly < SocketType > | property_type () const |
The sockets type to use for socket construction. | |
Static Public Member Functions | |
static Glib::RefPtr< SocketClient > | create () |
Protected Member Functions | |
SocketClient () | |
Related Functions | |
(Note that these are not member functions.) | |
Glib::RefPtr< Gio::SocketClient > | wrap (GSocketClient* object, bool take_copy=false) |
A Glib::wrap() method for this object. |
Detailed Description
Helper for connecting to a network service.
- See also:
- SocketConnection, SocketListener
SocketClient is a high-level utility class for connecting to a network host using a connection oriented socket type.
You create a SocketClient object, set any options you want, then call a sync or async connect operation, which returns a SocketConnection subclass on success.
The type of the SocketConnection object returned depends on the type of the underlying socket that is in use. For instance, for a TCP/IP connection it will be a TcpConnection.
Constructor & Destructor Documentation
virtual Gio::SocketClient::~SocketClient | ( | ) | [virtual] |
Gio::SocketClient::SocketClient | ( | ) | [protected] |
Member Function Documentation
void Gio::SocketClient::add_application_proxy | ( | const Glib::ustring& | protocol | ) |
Enable proxy protocols to be handled by the application.
When the indicated proxy protocol is returned by the ProxyResolver, SocketClient will consider this protocol as supported but will not try find a Proxy instance to handle handshaking. The application must check for this case by calling g_socket_connection_get_remote_address() on the returned SocketConnection, and seeing if it's a ProxyAddress of the appropriate type, to determine whether or not it needs to handle the proxy handshaking itself.
This should be used for proxy protocols that are dialects of another protocol such as HTTP proxy. It also allows cohabitation of proxy protocols that are reused between protocols. A good example is HTTP. It can be used to proxy HTTP, FTP and Gopher and can also be use as generic socket proxy through the HTTP CONNECT method.
- Parameters:
-
protocol The proxy protocol.
Glib::RefPtr<SocketConnection> Gio::SocketClient::connect | ( | const Glib::RefPtr< SocketConnectable >& | connectable, |
const Glib::RefPtr< Cancellable >& | cancellable | ||
) |
Tries to resolve the connectable and make a network connection to it.
Upon a successful connection, a new SocketConnection is constructed and returned. The caller owns this new object and must drop their reference to it when finished with it.
The type of the SocketConnection object returned depends on the type of the underlying socket that is used. For instance, for a TCP/IP connection it will be a TcpConnection.
The socket created will be the same family as the the address that the connectable resolves to, unless family is set with g_socket_client_set_family() or indirectly via g_socket_client_set_local_address(). The socket type defaults to SOCKET_TYPE_STREAM but can be set with g_socket_client_set_socket_type().
If a local address is specified with g_socket_client_set_local_address() the socket will be bound to this address before connecting.
- Parameters:
-
connectable A SocketConnectable specifying the remote address. cancellable Optional Cancellable object, 0
to ignore.
- Returns:
- A SocketConnection on success,
0
on error.
Glib::RefPtr<SocketConnection> Gio::SocketClient::connect | ( | const Glib::RefPtr< SocketConnectable >& | connectable | ) |
void Gio::SocketClient::connect_async | ( | const Glib::RefPtr< SocketConnectable >& | connectable, |
const Glib::RefPtr< Cancellable >& | cancellable, | ||
const SlotAsyncReady& | slot | ||
) |
This is the asynchronous version of g_socket_client_connect().
When the operation is finished callback will be called. You can then call g_socket_client_connect_finish() to get the result of the operation.
- Parameters:
-
connectable A SocketConnectable specifying the remote address. cancellable A Cancellable, or 0
.callback A AsyncReadyCallback. user_data User data for the callback.
void Gio::SocketClient::connect_async | ( | const Glib::RefPtr< SocketConnectable >& | connectable, |
const SlotAsyncReady& | slot | ||
) |
This is the asynchronous version of connect().
When the operation is finished slot will be called. You can then call finish() to get the result of the operation.
- Parameters:
-
connectable A SocketConnectable specifying the remote address. slot A callback slot to call after the operation completes.
Glib::RefPtr<SocketConnection> Gio::SocketClient::connect_finish | ( | const Glib::RefPtr< AsyncResult >& | result | ) |
Finishes an async connect operation.
See g_socket_client_connect_async()
- Parameters:
-
result A AsyncResult.
- Returns:
- A SocketConnection on success,
0
on error.
Glib::RefPtr<SocketConnection> Gio::SocketClient::connect_to_host | ( | const Glib::ustring& | host_and_port, |
guint16 | default_port | ||
) |
This is a helper function for connect().
This attempts to create a TCP connection to the named host.
host_and_port may be in any of a number of recognised formats; an IPv6 address, an IPv4 address, or a domain name (in which case a DNS lookup is performed). Quoting with [] is supported for all address types. A port override may be specified in the usual way with a colon. Ports may be given as decimal numbers or symbolic names (in which case an /etc/services lookup is performed).
If no port override is given in host_and_port then default_port will be used as the port number to connect to.
In general, host_and_port is expected to be provided by the user (allowing them to give the hostname, and a port overide if necessary) and default_port is expected to be provided by the application.
In the case that an IP address is given, a single connection attempt is made. In the case that a name is given, multiple connection attempts may be made, in turn and according to the number of address records in DNS, until a connection succeeds.
Upon a successful connection, a new SocketConnection is constructed and returned.
In the event of any failure (DNS error, service not found, no hosts connectable) an exception is thrown.
- Parameters:
-
host_and_port The name and optionally port of the host to connect to. default_port The default port to connect to.
Glib::RefPtr<SocketConnection> Gio::SocketClient::connect_to_host | ( | const Glib::ustring& | host_and_port, |
guint16 | default_port, | ||
const Glib::RefPtr< Cancellable >& | cancellable | ||
) |
This is a helper function for g_socket_client_connect().
Attempts to create a TCP connection to the named host.
host_and_port may be in any of a number of recognised formats; an IPv6 address, an IPv4 address, or a domain name (in which case a DNS lookup is performed). Quoting with [] is supported for all address types. A port override may be specified in the usual way with a colon. Ports may be given as decimal numbers or symbolic names (in which case an /etc/services lookup is performed).
If no port override is given in host_and_port then default_port will be used as the port number to connect to.
In general, host_and_port is expected to be provided by the user (allowing them to give the hostname, and a port overide if necessary) and default_port is expected to be provided by the application.
In the case that an IP address is given, a single connection attempt is made. In the case that a name is given, multiple connection attempts may be made, in turn and according to the number of address records in DNS, until a connection succeeds.
Upon a successful connection, a new SocketConnection is constructed and returned. The caller owns this new object and must drop their reference to it when finished with it.
In the event of any failure (DNS error, service not found, no hosts connectable) 0
is returned and error (if non-0
) is set accordingly.
- Parameters:
-
host_and_port The name and optionally port of the host to connect to. default_port The default port to connect to. cancellable A Cancellable, or 0
.
- Returns:
- A SocketConnection on success,
0
on error.
void Gio::SocketClient::connect_to_host_async | ( | const Glib::ustring& | host_and_port, |
guint16 | default_port, | ||
const Glib::RefPtr< Cancellable >& | cancellable, | ||
const SlotAsyncReady& | slot | ||
) |
This is the asynchronous version of g_socket_client_connect_to_host().
When the operation is finished callback will be called. You can then call g_socket_client_connect_to_host_finish() to get the result of the operation.
- Parameters:
-
host_and_port The name and optionally the port of the host to connect to. default_port The default port to connect to. cancellable A Cancellable, or 0
.callback A AsyncReadyCallback. user_data User data for the callback.
void Gio::SocketClient::connect_to_host_async | ( | const Glib::ustring& | host_and_port, |
guint16 | default_port, | ||
const SlotAsyncReady& | slot | ||
) |
This is the asynchronous version of connect_to_host().
When the operation is finished slot will be called. You can then call connect_to_host_finish() to get the result of the operation.
- Parameters:
-
host_and_port The name and optionally the port of the host to connect to. default_port The default port to connect to. slot A callback slot to call after the opration completes.
Glib::RefPtr<SocketConnection> Gio::SocketClient::connect_to_host_finish | ( | const Glib::RefPtr< AsyncResult >& | result | ) |
Finishes an async connect operation.
See g_socket_client_connect_to_host_async()
- Parameters:
-
result A AsyncResult.
- Returns:
- A SocketConnection on success,
0
on error.
Glib::RefPtr<SocketConnection> Gio::SocketClient::connect_to_service | ( | const Glib::ustring& | domain, |
const Glib::ustring& | service, | ||
const Glib::RefPtr< Cancellable >& | cancellable | ||
) |
Attempts to create a TCP connection to a service.
This call looks up the SRV record for service at domain for the "tcp" protocol. It then attempts to connect, in turn, to each of the hosts providing the service until either a connection succeeds or there are no hosts remaining.
Upon a successful connection, a new SocketConnection is constructed and returned. The caller owns this new object and must drop their reference to it when finished with it.
In the event of any failure (DNS error, service not found, no hosts connectable) 0
is returned and error (if non-0
) is set accordingly.
- Parameters:
-
domain A domain name. service The name of the service to connect to. cancellable A Cancellable, or 0
.
- Returns:
- A SocketConnection if successful, or
0
on error.
Glib::RefPtr<SocketConnection> Gio::SocketClient::connect_to_service | ( | const Glib::ustring& | domain, |
const Glib::ustring& | service | ||
) |
void Gio::SocketClient::connect_to_service_async | ( | const Glib::ustring& | domain, |
const Glib::ustring& | service, | ||
const Glib::RefPtr< Cancellable >& | cancellable, | ||
const SlotAsyncReady& | slot | ||
) |
This is the asynchronous version of g_socket_client_connect_to_service().
- Parameters:
-
domain A domain name. service The name of the service to connect to. cancellable A Cancellable, or 0
.callback A AsyncReadyCallback. user_data User data for the callback.
void Gio::SocketClient::connect_to_service_async | ( | const Glib::ustring& | domain, |
const Glib::ustring& | service, | ||
const SlotAsyncReady& | slot | ||
) |
This is the asynchronous version of connect_to_service().
- Parameters:
-
domain A domain name. service The name of the service to connect to slot A callback slot to call after the opration completes.
Glib::RefPtr<SocketConnection> Gio::SocketClient::connect_to_service_finish | ( | const Glib::RefPtr< AsyncResult >& | result | ) |
Finishes an async connect operation.
See g_socket_client_connect_to_service_async()
- Parameters:
-
result A AsyncResult.
- Returns:
- A SocketConnection on success,
0
on error.
Glib::RefPtr<SocketConnection> Gio::SocketClient::connect_to_uri | ( | const Glib::ustring& | uri, |
guint16 | default_port | ||
) |
This is a helper function for connect().
This attempts to create a TCP connection with a network URI.
uri may be any valid URI containing an "authority" (hostname/port) component. If a port is not specified in the URI, default_port will be used. TLS will be negotiated if "tls" is true. (GSocketClient does not know to automatically assume TLS for certain URI schemes.)
Using this rather than connect() or connect_to_host() allows SocketClient to determine when to use application-specific proxy protocols.
Upon a successful connection, a new SocketConnection is constructed and returned.
In the event of any failure (DNS error, service not found, no hosts connectable) an exception is thrown.
- Parameters:
-
uri A network URI default_port The default port to connect to.
Glib::RefPtr<SocketConnection> Gio::SocketClient::connect_to_uri | ( | const Glib::ustring& | uri, |
guint16 | default_port, | ||
const Glib::RefPtr< Cancellable >& | cancellable | ||
) |
This is a helper function for g_socket_client_connect().
Attempts to create a TCP connection with a network URI.
uri may be any valid URI containing an "authority" (hostname/port) component. If a port is not specified in the URI, default_port will be used. TLS will be negotiated if SocketClient:tls is true
. (SocketClient does not know to automatically assume TLS for certain URI schemes.)
Using this rather than g_socket_client_connect() or g_socket_client_connect_to_host() allows SocketClient to determine when to use application-specific proxy protocols.
Upon a successful connection, a new SocketConnection is constructed and returned. The caller owns this new object and must drop their reference to it when finished with it.
In the event of any failure (DNS error, service not found, no hosts connectable) 0
is returned and error (if non-0
) is set accordingly.
- Parameters:
-
uri A network URI. default_port The default port to connect to. cancellable A Cancellable, or 0
.
- Returns:
- A SocketConnection on success,
0
on error.
void Gio::SocketClient::connect_to_uri_async | ( | const Glib::ustring& | uri, |
guint16 | default_port, | ||
const SlotAsyncReady& | slot | ||
) |
This is the asynchronous version of connect_to_uri().
- Parameters:
-
uri A network URI. default_port The default port to connect to. slot A callback slot to call after the opration completes.
void Gio::SocketClient::connect_to_uri_async | ( | const Glib::ustring& | uri, |
guint16 | default_port, | ||
const Glib::RefPtr< Cancellable >& | cancellable, | ||
const SlotAsyncReady& | slot | ||
) |
This is the asynchronous version of g_socket_client_connect_to_uri().
When the operation is finished callback will be called. You can then call g_socket_client_connect_to_uri_finish() to get the result of the operation.
- Parameters:
-
uri A network uri. default_port The default port to connect to. cancellable A Cancellable, or 0
.callback A AsyncReadyCallback. user_data User data for the callback.
Glib::RefPtr<SocketConnection> Gio::SocketClient::connect_to_uri_finish | ( | const Glib::RefPtr< AsyncResult >& | result | ) |
Finishes an async connect operation.
See g_socket_client_connect_to_uri_async()
- Parameters:
-
result A AsyncResult.
- Returns:
- A SocketConnection on success,
0
on error.
static Glib::RefPtr<SocketClient> Gio::SocketClient::create | ( | ) | [static] |
bool Gio::SocketClient::get_enable_proxy | ( | ) | const |
Gets the proxy enable state; see g_socket_client_set_enable_proxy()
- Returns:
- Whether proxying is enabled.
SocketFamily Gio::SocketClient::get_family | ( | ) | const |
Gets the socket family of the socket client.
See g_socket_client_set_family() for details.
- Returns:
- A SocketFamily.
Glib::RefPtr<SocketAddress> Gio::SocketClient::get_local_address | ( | ) |
Gets the local address of the socket client.
See g_socket_client_set_local_address() for details.
- Returns:
- A SocketAddres or
0
. don't free.
Glib::RefPtr<const SocketAddress> Gio::SocketClient::get_local_address | ( | ) | const |
Gets the local address of the socket client.
See g_socket_client_set_local_address() for details.
- Returns:
- A SocketAddres or
0
. don't free.
SocketProtocol Gio::SocketClient::get_protocol | ( | ) | const |
Gets the protocol name type of the socket client.
See g_socket_client_set_protocol() for details.
- Returns:
- A SocketProtocol.
SocketType Gio::SocketClient::get_socket_type | ( | ) | const |
Gets the socket type of the socket client.
See g_socket_client_set_socket_type() for details.
- Returns:
- A SocketFamily.
guint Gio::SocketClient::get_timeout | ( | ) | const |
Gets the I/O timeout time for sockets created by client.
See g_socket_client_set_timeout() for details.
- Returns:
- The timeout in seconds.
const GSocketClient* Gio::SocketClient::gobj | ( | ) | const [inline] |
Provides access to the underlying C GObject.
Reimplemented from Glib::ObjectBase.
GSocketClient* Gio::SocketClient::gobj | ( | ) | [inline] |
Provides access to the underlying C GObject.
Reimplemented from Glib::ObjectBase.
GSocketClient* Gio::SocketClient::gobj_copy | ( | ) |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
Glib::PropertyProxy<SocketFamily> Gio::SocketClient::property_family | ( | ) |
The sockets address family to use for socket construction.
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
- Returns:
- A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly<SocketFamily> Gio::SocketClient::property_family | ( | ) | const |
The sockets address family to use for socket construction.
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
- Returns:
- A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
Glib::PropertyProxy< Glib::RefPtr<SocketAddress> > Gio::SocketClient::property_local_address | ( | ) |
The local address constructed sockets will be bound to.
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
- Returns:
- A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr<SocketAddress> > Gio::SocketClient::property_local_address | ( | ) | const |
The local address constructed sockets will be bound to.
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
- Returns:
- A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
Glib::PropertyProxy<SocketProtocol> Gio::SocketClient::property_protocol | ( | ) |
The protocol to use for socket construction, or 0 for default.
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
- Returns:
- A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly<SocketProtocol> Gio::SocketClient::property_protocol | ( | ) | const |
The protocol to use for socket construction, or 0 for default.
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
- Returns:
- A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
Glib::PropertyProxy<SocketType> Gio::SocketClient::property_type | ( | ) |
The sockets type to use for socket construction.
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
- Returns:
- A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly<SocketType> Gio::SocketClient::property_type | ( | ) | const |
The sockets type to use for socket construction.
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
- Returns:
- A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
void Gio::SocketClient::set_enable_proxy | ( | bool | enable | ) |
Sets whether or not client attempts to make connections via a proxy server.
When enabled (the default), SocketClient will use a ProxyResolver to determine if a proxy protocol such as SOCKS is needed, and automatically do the necessary proxy negotiation.
- Parameters:
-
enable Whether to enable proxies.
void Gio::SocketClient::set_family | ( | SocketFamily | family | ) |
Sets the socket family of the socket client.
If this is set to something other than SOCKET_FAMILY_INVALID then the sockets created by this object will be of the specified family.
This might be useful for instance if you want to force the local connection to be an ipv4 socket, even though the address might be an ipv6 mapped to ipv4 address.
- Parameters:
-
family A SocketFamily.
void Gio::SocketClient::set_local_address | ( | const Glib::RefPtr< SocketAddress >& | address | ) |
Sets the local address of the socket client.
The sockets created by this object will bound to the specified address (if not 0
) before connecting.
This is useful if you want to ensure the the local side of the connection is on a specific port, or on a specific interface.
- Parameters:
-
address A SocketAddress, or 0
.
void Gio::SocketClient::set_protocol | ( | SocketProtocol | protocol | ) |
Sets the protocol of the socket client.
The sockets created by this object will use of the specified protocol.
If protocol is %0 that means to use the default protocol for the socket family and type.
- Parameters:
-
protocol A SocketProtocol.
void Gio::SocketClient::set_socket_type | ( | SocketType | type | ) |
Sets the socket type of the socket client.
The sockets created by this object will be of the specified type.
It doesn't make sense to specify a type of SOCKET_TYPE_DATAGRAM, as GSocketClient is used for connection oriented services.
- Parameters:
-
type A SocketType.
void Gio::SocketClient::set_timeout | ( | guint | enable | ) |
Sets the I/O timeout for sockets created by client.
timeout is a time in seconds, or 0 for no timeout (the default).
The timeout value affects the initial connection attempt as well, so setting this may cause calls to g_socket_client_connect(), etc, to fail with IO_ERROR_TIMED_OUT.
- Parameters:
-
timeout The timeout.
Friends And Related Function Documentation
Glib::RefPtr< Gio::SocketClient > wrap | ( | GSocketClient * | object, |
bool | take_copy = false |
||
) | [related] |
A Glib::wrap() method for this object.
- Parameters:
-
object The C instance. take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
- Returns:
- A C++ instance that wraps this C instance.