gio.socket_client
Module for [SocketClient] class
Types 3
[gio.socket_client.SocketClient] is a lightweight high-level utility class for connecting to a network host using a connection oriented socket type.
You create a [gio.socket_client.SocketClient] object, set any options you want, and then call a sync or async connect operation, which returns a [gio.socket_connection.SocketConnection] subclass on success.
The type of the [gio.socket_connection.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 [gio.tcp_connection.TcpConnection].
As [gio.socket_client.SocketClient] is a lightweight object, you don't need to cache it. You can just create a new one any time you need one.
SocketClient self()Returns `this`, for use in `with` statements.SocketClientGidBuilder builder()Get builder for [gio.socket_client.SocketClient] Returns: New builder objectvoid enableProxy(bool propval) @propertySet `enableProxy` property. Params: propval = Enable proxy support.gio.types.SocketFamily family() @propertyGet `family` property. Returns: The address family to use for socket construction.void family(gio.types.SocketFamily propval) @propertySet `family` property. Params: propval = The address family to use for socket construction.gio.socket_address.SocketAddress localAddress() @propertyGet `localAddress` property. Returns: The local address constructed sockets will be bound to.void localAddress(gio.socket_address.SocketAddress propval) @propertySet `localAddress` property. Params: propval = The local address constructed sockets will be bound to.gio.types.SocketProtocol protocol() @propertyGet `protocol` property. Returns: The protocol to use for socket construction, or `0` for default.void protocol(gio.types.SocketProtocol propval) @propertySet `protocol` property. Params: propval = The protocol to use for socket construction, or `0` for default.gio.proxy_resolver.ProxyResolver proxyResolver() @propertyGet `proxyResolver` property. Returns: The proxy resolver to usevoid proxyResolver(gio.proxy_resolver.ProxyResolver propval) @propertySet `proxyResolver` property. Params: propval = The proxy resolver to useuint timeout() @propertyGet `timeout` property. Returns: The I/O timeout for sockets, in seconds, or `0` for none.void timeout(uint propval) @propertySet `timeout` property. Params: propval = The I/O timeout for sockets, in seconds, or `0` for none.void tls(bool propval) @propertySet `tls` property. Params: propval = Whether to create TLS connections.gio.types.TlsCertificateFlags tlsValidationFlags() @propertyGet `tlsValidationFlags` property. Returns: The TLS validation flags used when creating TLS connections. The default value is [gio.types.TlsCertificateFlags.ValidateAll].void tlsValidationFlags(gio.types.TlsCertificateFlags propval) @propertySet `tlsValidationFlags` property. Params: propval = The TLS validation flags used when creating TLS connections. The default value is [gio.types.TlsCertificateFlags.ValidateAll].gio.types.SocketType type() @propertyGet `type` property. Returns: The type to use for socket construction.void type(gio.types.SocketType propval) @propertySet `type` property. Params: propval = The type to use for socket construction.void addApplicationProxy(string protocol)Enable proxy protocols to be handled by the application. When the indicated proxy protocol is returned by the #GProxyResolver, #GSocketClient will consider this protocol as supported but will not t...gio.socket_connection.SocketConnection connect(gio.socket_connectable.SocketConnectable connectable, gio.cancellable.Cancellable cancellable = null)Tries to resolve the connectable and make a network connection to it.void connectAsync(gio.socket_connectable.SocketConnectable connectable, gio.cancellable.Cancellable cancellable = null, gio.types.AsyncReadyCallback callback = null)This is the asynchronous version of [gio.socket_client.SocketClient.connect].gio.socket_connection.SocketConnection connectFinish(gio.async_result.AsyncResult result)Finishes an async connect operation. See [gio.socket_client.SocketClient.connectAsync]gio.socket_connection.SocketConnection connectToHost(string hostAndPort, ushort defaultPort, gio.cancellable.Cancellable cancellable = null)This is a helper function for [gio.socket_client.SocketClient.connect].void connectToHostAsync(string hostAndPort, ushort defaultPort, gio.cancellable.Cancellable cancellable = null, gio.types.AsyncReadyCallback callback = null)This is the asynchronous version of [gio.socket_client.SocketClient.connectToHost].gio.socket_connection.SocketConnection connectToHostFinish(gio.async_result.AsyncResult result)Finishes an async connect operation. See [gio.socket_client.SocketClient.connectToHostAsync]gio.socket_connection.SocketConnection connectToService(string domain, string service, gio.cancellable.Cancellable cancellable = null)Attempts to create a TCP connection to a service.void connectToServiceAsync(string domain, string service, gio.cancellable.Cancellable cancellable = null, gio.types.AsyncReadyCallback callback = null)This is the asynchronous version of [gio.socket_client.SocketClient.connectToService].gio.socket_connection.SocketConnection connectToServiceFinish(gio.async_result.AsyncResult result)Finishes an async connect operation. See [gio.socket_client.SocketClient.connectToServiceAsync]gio.socket_connection.SocketConnection connectToUri(string uri, ushort defaultPort, gio.cancellable.Cancellable cancellable = null)This is a helper function for [gio.socket_client.SocketClient.connect].void connectToUriAsync(string uri, ushort defaultPort, gio.cancellable.Cancellable cancellable = null, gio.types.AsyncReadyCallback callback = null)This is the asynchronous version of [gio.socket_client.SocketClient.connectToUri].gio.socket_connection.SocketConnection connectToUriFinish(gio.async_result.AsyncResult result)Finishes an async connect operation. See [gio.socket_client.SocketClient.connectToUriAsync]bool getEnableProxy()Gets the proxy enable state; see [gio.socket_client.SocketClient.setEnableProxy] Returns: whether proxying is enabledgio.types.SocketFamily getFamily()Gets the socket family of the socket client.gio.socket_address.SocketAddress getLocalAddress()Gets the local address of the socket client.gio.types.SocketProtocol getProtocol()Gets the protocol name type of the socket client.gio.proxy_resolver.ProxyResolver getProxyResolver()Gets the #GProxyResolver being used by client. Normally, this will be the resolver returned by [gio.proxyresolver.ProxyResolver.getDefault], but you can override it with [gio.socketclient.SocketCli...gio.types.SocketType getSocketType()Gets the socket type of the socket client.uint getTimeout()Gets the I/O timeout time for sockets created by client.bool getTls()Gets whether client creates TLS connections. See [gio.socket_client.SocketClient.setTls] for details. Returns: whether client uses TLSgio.types.TlsCertificateFlags getTlsValidationFlags()Gets the TLS validation flags used creating TLS connections via client.void setEnableProxy(bool enable)Sets whether or not client attempts to make connections via a proxy server. When enabled (the default), #GSocketClient will use a #GProxyResolver to determine if a proxy protocol such as SOCKS is n...void setFamily(gio.types.SocketFamily family)Sets the socket family of the socket client. If this is set to something other than [gio.types.SocketFamily.Invalid] then the sockets created by this object will be of the specified family.void setLocalAddress(gio.socket_address.SocketAddress address = null)Sets the local address of the socket client. The sockets created by this object will bound to the specified address (if not null) before connecting.void setProtocol(gio.types.SocketProtocol protocol)Sets the protocol of the socket client. The sockets created by this object will use of the specified protocol.void setProxyResolver(gio.proxy_resolver.ProxyResolver proxyResolver = null)Overrides the #GProxyResolver used by client. You can call this if you want to use specific proxies, rather than using the system default proxy settings.void setSocketType(gio.types.SocketType type)Sets the socket type of the socket client. The sockets created by this object will be of the specified type.void setTimeout(uint timeout)Sets the I/O timeout for sockets created by client. timeout is a time in seconds, or 0 for no timeout (the default).void setTls(bool tls)Sets whether client creates TLS (aka SSL) connections. If tls is true, client will wrap its connections in a #GTlsClientConnection and perform a TLS handshake when connecting.void setTlsValidationFlags(gio.types.TlsCertificateFlags flags)Sets the TLS validation flags used when creating TLS connections via client. The default value is [gio.types.TlsCertificateFlags.ValidateAll].gulong connectEvent(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == void)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] == gio.types.SocketClientEvent)))
&& (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gio.socket_connectable.SocketConnectable)))
&& (Parameters!T.length < 3 || (ParameterStorageClassTuple!T[2] == ParameterStorageClass.none && is(Parameters!T[2] : gio.iostream.IOStream)))
&& (Parameters!T.length < 4 || (ParameterStorageClassTuple!T[3] == ParameterStorageClass.none && is(Parameters!T[3] : gio.socket_client.SocketClient)))
&& Parameters!T.length < 5)Connect to `Event` signal.T enableProxy(bool propval)Set `enableProxy` property. Params: propval = Enable proxy support. Returns: Builder instance for fluent chainingT family(gio.types.SocketFamily propval)Set `family` property. Params: propval = The address family to use for socket construction. Returns: Builder instance for fluent chainingT localAddress(gio.socket_address.SocketAddress propval)Set `localAddress` property. Params: propval = The local address constructed sockets will be bound to. Returns: Builder instance for fluent chainingT protocol(gio.types.SocketProtocol propval)Set `protocol` property. Params: propval = The protocol to use for socket construction, or `0` for default. Returns: Builder instance for fluent chainingT proxyResolver(gio.proxy_resolver.ProxyResolver propval)Set `proxyResolver` property. Params: propval = The proxy resolver to use Returns: Builder instance for fluent chainingT timeout(uint propval)Set `timeout` property. Params: propval = The I/O timeout for sockets, in seconds, or `0` for none. Returns: Builder instance for fluent chainingT tls(bool propval)Set `tls` property. Params: propval = Whether to create TLS connections. Returns: Builder instance for fluent chainingT tlsValidationFlags(gio.types.TlsCertificateFlags propval)Set `tlsValidationFlags` property. Params: propval = The TLS validation flags used when creating TLS connections. The default value is [gio.types.TlsCertificateFlags.ValidateAll].T type(gio.types.SocketType propval)Set `type` property. Params: propval = The type to use for socket construction. Returns: Builder instance for fluent chainingFluent builder for [gio.socket_client.SocketClient]