[]Struct gio::SocketService

pub struct SocketService(_, _);

A SocketService is an object that represents a service that is provided to the network or over local sockets. When a new connection is made to the service the SocketService::incoming signal is emitted.

A SocketService is a subclass of SocketListener and you need to add the addresses you want to accept connections on with the SocketListener APIs.

There are two options for implementing a network service based on SocketService. The first is to create the service using SocketService::new and to connect to the SocketService::incoming signal. The second is to subclass SocketService and override the default signal handler implementation.

In either case, the handler must immediately return, or else it will block additional incoming connections from being serviced. If you are interested in writing connection handlers that contain blocking code then see ThreadedSocketService.

The socket service runs on the main loop of the [thread-default context][g-main-context-push-thread-default-context] of the thread it is created in, and is not threadsafe in general. However, the calls to start and stop the service are thread-safe so these can be used from threads that handle incoming clients.

Implements

SocketServiceExt, SocketListenerExt, glib::object::ObjectExt, SocketListenerExtManual

Methods

impl SocketService[src]

pub fn new() -> SocketService[src]

Creates a new SocketService with no sockets to listen for. New listeners can be added with e.g. SocketListenerExt::add_address or SocketListenerExt::add_inet_port.

New services are created active, there is no need to call SocketServiceExt::start, unless SocketServiceExt::stop has been called before.

Returns

a new SocketService.

Trait Implementations

impl Clone for SocketService

impl Debug for SocketService

impl Default for SocketService[src]

impl Display for SocketService[src]

impl Eq for SocketService

impl Hash for SocketService

impl IsA<SocketListener> for SocketService

impl IsA<SocketService> for ThreadedSocketService

impl Ord for SocketService

impl<T: ObjectType> PartialEq<T> for SocketService

impl<T: ObjectType> PartialOrd<T> for SocketService

impl StaticType for SocketService

Auto Trait Implementations

impl RefUnwindSafe for SocketService

impl !Send for SocketService

impl !Sync for SocketService

impl Unpin for SocketService

impl UnwindSafe for SocketService

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<Super, Sub> CanDowncast<Sub> for Super where
    Sub: IsA<Super>,
    Super: IsA<Super>, 
[src]

impl<T> Cast for T where
    T: ObjectType
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ObjectExt for T where
    T: ObjectType
[src]

impl<'a, T> ToGlibContainerFromSlice<'a, *const GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<'a, T> ToGlibContainerFromSlice<'a, *const GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> ToValue for T where
    T: SetValue + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.