[−][src]Struct lunatic::net::TcpListener
A TCP server, listening for connections.
After creating a TcpListener
by bind
ing it to an address, it
listens for incoming TCP connections. These can be accepted by calling
accept()
.
Cloning a TcpListener
creates another handle to the same socket. The socket will be closed
when all handles to it are dropped.
The Transmission Control Protocol is specified in IETF RFC 793.
Examples
use lunatic::net::TcpListener;
Implementations
impl TcpListener
[src]
pub fn bind<A>(addr: A) -> Result<Self> where
A: ToSocketAddrs,
[src]
A: ToSocketAddrs,
Creates a new TcpListener
bound to the given address.
Binding with a port number of 0 will request that the operating system assigns an available port to this listener.
If addr
yields multiple addresses, binding will be attempted with each of the addresses
until one succeeds and returns the listener. If none of the addresses succeed in creating a
listener, the error from the last attempt is returned.
pub fn accept(&self) -> Result<TcpStream, u32>
[src]
Accepts a new incoming connection.
Returns a TCP stream.
Trait Implementations
impl Clone for TcpListener
[src]
fn clone(&self) -> TcpListener
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<'de> Deserialize<'de> for TcpListener
[src]
fn deserialize<D>(deserializer: D) -> Result<TcpListener, D::Error> where
D: Deserializer<'de>,
[src]
D: Deserializer<'de>,
impl Serialize for TcpListener
[src]
Auto Trait Implementations
impl !RefUnwindSafe for TcpListener
[src]
impl !Send for TcpListener
[src]
impl !Sync for TcpListener
[src]
impl Unpin for TcpListener
[src]
impl UnwindSafe for TcpListener
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,