### Interface

# Camel NetworkService

since: 3.2

#### Description

    interface Camel.NetworkService : Camel.Service

No description available.

Available since: 3.2

#### Prerequisite

In order to implement NetworkService, your type must inherit from`CamelService`.

#### Instance methods

###### camel_network_service_can_reach

Asynchronously attempts to determine whether or not the host described by `service`‘s `CamelNetworkService:connectable` property can be reached, without actually trying to connect to it.

since: 3.12

###### camel_network_service_can_reach_finish

Finishes the operation started with camel_network_service_can_reach().

since: 3.12

###### camel_network_service_can_reach_sync

Attempts to determine whether or not the host described by `service`‘s `CamelNetworkService:connectable` property can be reached, without actually trying to connect to it.

since: 3.12

###### camel_network_service_connect_sync

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

since: 3.2

###### camel_network_service_get_default_port

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.

since: 3.2

###### camel_network_service_get_host_reachable

Returns `TRUE` if `service` believes that the host pointed to by `CamelNetworkService:connectable` can be reached. This property is updated automatically as network conditions change.

since: 3.8

###### camel_network_service_get_service_name

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”.

since: 3.2

###### camel_network_service_ref_connectable

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

since: 3.8

###### camel_network_service_set_connectable

Sets the socket endpoint for the network service to which `service` is a client. If `connectable` is `NULL`, a `GSocketConnectable` is derived from the `service`‘s `CamelNetworkSettings`.

since: 3.8

###### camel_network_service_starttls

Creates a `GTlsClientConnection` wrapping `base_stream`, which is assumed to communicate with the server identified by `service`‘s `CamelNetworkService:connectable`.

since: 3.12

#### Properties

###### Camel.NetworkService:connectable

Socket endpoint of a network service.

###### Camel.NetworkService:host-reachable

Whether the host is reachable.

#### Interface structure

    struct CamelNetworkServiceInterface {
      GTypeInterface parent_interface;
      const gchar* (* get_service_name) (
        CamelNetworkService* service,
        CamelNetworkSecurityMethod method
      );
      guint16 (* get_default_port) (
        CamelNetworkService* service,
        CamelNetworkSecurityMethod method
      );
      GIOStream* (* connect_sync) (
        CamelNetworkService* service,
        GCancellable* cancellable,
        GError** error
      );
      GSocketConnectable* (* new_connectable) (
        CamelNetworkService* service
      );
      gpointer reserved;

    }

No description available.

###### Interface members

`parent_interface` |
    GTypeInterface
| No description available.
`get_service_name` |
    const gchar* (* get_service_name) (
        CamelNetworkService* service,
        CamelNetworkSecurityMethod method
      )
| No description available.
`get_default_port` |
    guint16 (* get_default_port) (
        CamelNetworkService* service,
        CamelNetworkSecurityMethod method
      )
| No description available.
`connect_sync` |
    GIOStream* (* connect_sync) (
        CamelNetworkService* service,
        GCancellable* cancellable,
        GError** error
      )
| No description available.
`new_connectable` |
    GSocketConnectable* (* new_connectable) (
        CamelNetworkService* service
      )
| No description available.
`reserved` |
    gpointer
| No description available.

#### Virtual methods

###### Camel.NetworkService.connect_sync

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

since: 3.2

###### Camel.NetworkService.get_default_port

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.

since: 3.2

###### Camel.NetworkService.get_service_name

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”.

since: 3.2

###### Camel.NetworkService.new_connectable

No description available.