Struct nng::Listener[][src]

pub struct Listener { /* fields omitted */ }

Active listener for incoming connections.

A Listener is the object that is responsible for accepting incoming connections. A given Listener can have many connections to multiple clients simultaneously. Directly creating a listener object is only necessary when one wishes to configure the listener before opening it or if one wants to close the connections without closing the socket. Otherwise, Socket::listen can be used.

Note that the client/server relationship described by a dialer/listener is completely orthogonal to any similar relationship in the protocols. For example, a rep socket may use a dialer to connect to a listener on a req socket. This orthogonality can lead to innovative solutions to otherwise challenging communications problems.

See the NNG documentation for more information.

Implementations

impl Listener[src]

pub fn new(socket: &Socket, url: &str) -> Result<Self>[src]

Creates a new listener object associated with the given socket.

Note that this will immediately start the listener so no configuration will be possible. Use ListenerBuilder to change the listener options before starting it.

Errors

pub fn close(self)[src]

Closes the listener.

This also closes any Pipe objects that have been created by the listener. Once this function returns, the listener has been closed and all of its resources have been deallocated. Therefore, any attempt to utilize the listener (with this or any other handle) will result in an error.

Listeners are implicitly closed when the socket they are associated with is closed. Listeners are not closed when all handles are dropped.

Trait Implementations

impl Clone for Listener[src]

impl Copy for Listener[src]

impl Debug for Listener[src]

impl Eq for Listener[src]

impl GetOpt<BoundPort> for Listener[src]

impl GetOpt<KeepAlive> for Listener[src]

impl GetOpt<LocalAddr> for Listener[src]

impl GetOpt<MaxTtl> for Listener[src]

impl GetOpt<NoDelay> for Listener[src]

impl GetOpt<Protocol> for Listener[src]

impl GetOpt<Raw> for Listener[src]

impl GetOpt<RecvBufferSize> for Listener[src]

impl GetOpt<RecvTimeout> for Listener[src]

impl GetOpt<ResendTime> for Listener[src]

impl GetOpt<SendBufferSize> for Listener[src]

impl GetOpt<SendTimeout> for Listener[src]

impl GetOpt<SocketName> for Listener[src]

impl GetOpt<SurveyTime> for Listener[src]

impl GetOpt<Url> for Listener[src]

impl Hash for Listener[src]

impl Ord for Listener[src]

impl PartialEq<Listener> for Listener[src]

impl PartialOrd<Listener> for Listener[src]

Auto Trait Implementations

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<T> From<T> for T[src]

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

impl<T> Options for T where
    T: HasOpts, 
[src]

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

type Owned = T

The resulting type after obtaining ownership.

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.