Trait gio::prelude::SocketConnectionExt[][src]

pub trait SocketConnectionExt: 'static {
    fn connect<P: IsA<SocketAddress>, Q: IsA<Cancellable>>(
        &self,
        address: &P,
        cancellable: Option<&Q>
    ) -> Result<(), Error>;
fn connect_async<P: IsA<SocketAddress>, Q: IsA<Cancellable>, R: FnOnce(Result<(), Error>) + Send + 'static>(
        &self,
        address: &P,
        cancellable: Option<&Q>,
        callback: R
    );
fn connect_async_future<P: IsA<SocketAddress> + Clone + 'static>(
        &self,
        address: &P
    ) -> Pin<Box_<dyn Future<Output = Result<(), Error>> + 'static>>;
fn local_address(&self) -> Result<SocketAddress, Error>;
fn remote_address(&self) -> Result<SocketAddress, Error>;
fn socket(&self) -> Socket;
fn is_connected(&self) -> bool; }
Expand description

Required methods

Connect self to the specified remote address.

address

a SocketAddress specifying the remote address.

cancellable

a GCancellable or None

Returns

true if the connection succeeded, false on error

Asynchronously connect self to the specified remote address.

This clears the property::Socket::blocking flag on self’s underlying socket if it is currently set.

Use g_socket_connection_connect_finish() to retrieve the result.

address

a SocketAddress specifying the remote address.

cancellable

a GCancellable or None

callback

a GAsyncReadyCallback

Try to get the local address of a socket connection.

Returns

a SocketAddress or None on error. Free the returned object with g_object_unref().

Try to get the remote address of a socket connection.

Since GLib 2.40, when used with SocketClientExt::connect() or SocketClientExt::connect_async(), during emission of SocketClientEvent::Connecting, this function will return the remote address that will be used for the connection. This allows applications to print e.g. “Connecting to example.com (10.42.77.3)…”.

Returns

a SocketAddress or None on error. Free the returned object with g_object_unref().

Gets the underlying Socket object of the connection. This can be useful if you want to do something unusual on it not supported by the SocketConnection APIs.

Returns

a Socket or None on error.

Checks if self is connected. This is equivalent to calling SocketExt::is_connected() on self’s underlying Socket.

Returns

whether self is connected

Implementors