Camel.NetworkService

g Camel.NetworkService Camel.NetworkService GObject.GInterface GObject.GInterface GObject.GInterface->Camel.NetworkService

Implementations:

None

Methods

can_reach (cancellable, callback, *user_data)

can_reach_finish (result)

can_reach_sync (cancellable)

connect_sync (cancellable)

get_default_port (method)

get_host_reachable ()

get_service_name (method)

ref_connectable ()

set_connectable (connectable)

starttls (base_stream)

Virtual Methods

do_connect_sync (cancellable)

do_get_default_port (method)

do_get_service_name (method)

Properties

Name

Type

Flags

Short Description

connectable

Gio.SocketConnectable

r/w

Socket endpoint of a network service

host-reachable

bool

r

Whether the host is reachable

Signals

None

Fields

None

Class Details

class Camel.NetworkService
Bases:

GObject.GInterface

Structure:

Camel.NetworkServiceInterface

New in version 3.2.

can_reach(cancellable, callback, *user_data)
Parameters:

Asynchronously attempts to determine whether or not the host described by self's Camel.NetworkService :connectable property can be reached, without actually trying to connect to it.

For more details, see Camel.NetworkService.can_reach_sync().

When the operation is finished, callback will be called. You can then call Camel.NetworkService.can_reach_finish() to get the result of the operation.

New in version 3.12.

can_reach_finish(result)
Parameters:

result (Gio.AsyncResult) – a Gio.AsyncResult

Raises:

GLib.Error

Returns:

whether the host for self can be reached

Return type:

bool

Finishes the operation started with Camel.NetworkService.can_reach().

New in version 3.12.

can_reach_sync(cancellable)
Parameters:

cancellable (Gio.Cancellable or None) – optional Gio.Cancellable object, or None

Raises:

GLib.Error

Returns:

whether the host for self can be reached

Return type:

bool

Attempts to determine whether or not the host described by self's Camel.NetworkService :connectable property can be reached, without actually trying to connect to it.

If self believes an attempt to connect will succeed, the function returns True. Otherwise the function returns False and sets error to an appropriate error (such as Gio.IOErrorEnum.HOST_UNREACHABLE).

The function will also update the self's Camel.NetworkService :host-reachable property based on the result.

New in version 3.12.

connect_sync(cancellable)
Parameters:

cancellable (Gio.Cancellable or None) – optional Gio.Cancellable object, or None

Raises:

GLib.Error

Returns:

a Gio.IOStream, or None on error

Return type:

Gio.IOStream

Attempts to establish a network connection to the server described by self, using the preferred Camel.NetworkSettings :security-method to secure the connection. If a connection cannot be established, or the connection attempt is cancelled, the function sets error and returns None.

New in version 3.2.

get_default_port(method)
Parameters:

method (Camel.NetworkSecurityMethod) – a Camel.NetworkSecurityMethod

Returns:

the default port number for self and method

Return type:

int

Returns the default network port number for self and the security method method, as defined in /etc/services. For example, the default port for unencrypted IMAP or encrypted IMAP using STARTTLS is 143, but the default port for IMAP over SSL is 993.

New in version 3.2.

get_host_reachable()
Returns:

whether the host is reachable

Return type:

bool

Returns True if self believes that the host pointed to by Camel.NetworkService :connectable can be reached. This property is updated automatically as network conditions change.

New in version 3.8.

get_service_name(method)
Parameters:

method (Camel.NetworkSecurityMethod) – a Camel.NetworkSecurityMethod

Returns:

the network service name for self and method, or None

Return type:

str or None

Returns the standard network service name for self and the security method method, as defined in /etc/services. For example, the service name for unencrypted IMAP or encrypted IMAP using STARTTLS is “imap”, but the service name for IMAP over SSL is “imaps”.

New in version 3.2.

ref_connectable()
Returns:

a Gio.SocketConnectable

Return type:

Gio.SocketConnectable

Returns the socket endpoint for the network service to which self is a client.

The returned Gio.SocketConnectable is referenced for thread-safety and must be unreferenced with GObject.Object.unref() when finished with it.

New in version 3.8.

set_connectable(connectable)
Parameters:

connectable (Gio.SocketConnectable or None) – a Gio.SocketConnectable, or None

Sets the socket endpoint for the network service to which self is a client. If connectable is None, a Gio.SocketConnectable is derived from the self's Camel.NetworkSettings.

New in version 3.8.

starttls(base_stream)
Parameters:

base_stream (Gio.IOStream) – a Gio.IOStream

Raises:

GLib.Error

Returns:

the new Gio.TlsClientConnection, or None on error

Return type:

Gio.IOStream or None

Creates a Gio.TlsClientConnection wrapping base_stream, which is assumed to communicate with the server identified by self's Camel.NetworkService :connectable.

This should typically be called after issuing a STARTTLS command to a server to initiate a Transport Layer Security handshake.

New in version 3.12.

do_connect_sync(cancellable) virtual
Parameters:

cancellable (Gio.Cancellable or None) – optional Gio.Cancellable object, or None

Returns:

a Gio.IOStream, or None on error

Return type:

Gio.IOStream

Attempts to establish a network connection to the server described by service, using the preferred Camel.NetworkSettings :security-method to secure the connection. If a connection cannot be established, or the connection attempt is cancelled, the function sets error and returns None.

New in version 3.2.

do_get_default_port(method) virtual
Parameters:

method (Camel.NetworkSecurityMethod) – a Camel.NetworkSecurityMethod

Returns:

the default port number for service and method

Return type:

int

Returns the default network port number for service and the security method method, as defined in /etc/services. For example, the default port for unencrypted IMAP or encrypted IMAP using STARTTLS is 143, but the default port for IMAP over SSL is 993.

New in version 3.2.

do_get_service_name(method) virtual
Parameters:

method (Camel.NetworkSecurityMethod) – a Camel.NetworkSecurityMethod

Returns:

the network service name for service and method, or None

Return type:

str or None

Returns the standard network service name for service and the security method method, as defined in /etc/services. For example, the service name for unencrypted IMAP or encrypted IMAP using STARTTLS is “imap”, but the service name for IMAP over SSL is “imaps”.

New in version 3.2.

Property Details

Camel.NetworkService.props.connectable
Name:

connectable

Type:

Gio.SocketConnectable

Default Value:

None

Flags:

READABLE, WRITABLE

Socket endpoint of a network service

Camel.NetworkService.props.host_reachable
Name:

host-reachable

Type:

bool

Default Value:

False

Flags:

READABLE

Whether the host is reachable