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.
SocketClientGidBuilder builder() static nothrowGet builder for [gio.socket_client.SocketClient] Returns: New builder objectvoid enableProxy(bool propval) @property nothrowSet `enableProxy` property. Params: propval = Enable proxy support.gio.types.SocketFamily family() @property nothrowGet `family` property. Returns: The address family to use for socket construction.void family(gio.types.SocketFamily propval) @property nothrowSet `family` property. Params: propval = The address family to use for socket construction.gio.socket_address.SocketAddress localAddress() @property nothrowGet `localAddress` property. Returns: The local address constructed sockets will be bound to.void localAddress(gio.socket_address.SocketAddress propval) @property nothrowSet `localAddress` property. Params: propval = The local address constructed sockets will be bound to.gio.types.SocketProtocol protocol() @property nothrowGet `protocol` property. Returns: The protocol to use for socket construction, or `0` for default.void protocol(gio.types.SocketProtocol propval) @property nothrowSet `protocol` property. Params: propval = The protocol to use for socket construction, or `0` for default.gio.proxy_resolver.ProxyResolver proxyResolver() @property nothrowGet `proxyResolver` property. Returns: The proxy resolver to usevoid proxyResolver(gio.proxy_resolver.ProxyResolver propval) @property nothrowSet `proxyResolver` property. Params: propval = The proxy resolver to useuint timeout() @property nothrowGet `timeout` property. Returns: The I/O timeout for sockets, in seconds, or `0` for none.void timeout(uint propval) @property nothrowSet `timeout` property. Params: propval = The I/O timeout for sockets, in seconds, or `0` for none.void tls(bool propval) @property nothrowSet `tls` property. Params: propval = Whether to create TLS connections.gio.types.TlsCertificateFlags tlsValidationFlags() @property nothrowGet `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) @property nothrowSet `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() @property nothrowGet `type` property. Returns: The type to use for socket construction.void type(gio.types.SocketType propval) @property nothrowSet `type` property. Params: propval = The type to use for socket construction.void addApplicationProxy(string protocol) nothrowEnable 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) nothrowThis 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) nothrowThis 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) nothrowThis 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) nothrowThis 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() nothrowGets the proxy enable state; see [gio.socket_client.SocketClient.setEnableProxy] Returns: whether proxying is enabledgio.socket_address.SocketAddress getLocalAddress() nothrowGets the local address of the socket client.gio.proxy_resolver.ProxyResolver getProxyResolver() nothrowGets the #GProxyResolver being used by client. Normally, this will be the resolver returned by [gio.proxy_resolver.ProxyResolver.getDefault], but you can override it with [gio.socket_client.SocketC...bool getTls() nothrowGets whether client creates TLS connections. See [gio.socket_client.SocketClient.setTls] for details. Returns: whether client uses TLSgio.types.TlsCertificateFlags getTlsValidationFlags() nothrowGets the TLS validation flags used creating TLS connections via client.void setEnableProxy(bool enable) nothrowSets 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) nothrowSets 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) nothrowSets 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) nothrowSets 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) nothrowOverrides 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) nothrowSets the socket type of the socket client. The sockets created by this object will be of the specified type.void setTimeout(uint timeout) nothrowSets 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) nothrowSets 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) nothrowSets 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) nothrowConnect to `Event` signal.Fluent builder implementation template for gio.socket_client.SocketClient
T enableProxy(bool propval) nothrowSet `enableProxy` property. Params: propval = Enable proxy support. Returns: Builder instance for fluent chainingT family(gio.types.SocketFamily propval) nothrowSet `family` property. Params: propval = The address family to use for socket construction. Returns: Builder instance for fluent chainingT localAddress(gio.socket_address.SocketAddress propval) nothrowSet `localAddress` property. Params: propval = The local address constructed sockets will be bound to. Returns: Builder instance for fluent chainingT protocol(gio.types.SocketProtocol propval) nothrowSet `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) nothrowSet `proxyResolver` property. Params: propval = The proxy resolver to use Returns: Builder instance for fluent chainingT timeout(uint propval) nothrowSet `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) nothrowSet `tls` property. Params: propval = Whether to create TLS connections. Returns: Builder instance for fluent chainingT tlsValidationFlags(gio.types.TlsCertificateFlags propval) nothrowSet `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) nothrowSet `type` property. Params: propval = The type to use for socket construction. Returns: Builder instance for fluent chainingFluent builder for gio.socket_client.SocketClient