pub struct TcpSocket { /* private fields */ }
Expand description
Implementations§
source§impl TcpSocket
impl TcpSocket
sourcepub fn local_addr(&self) -> AxResult<SocketAddr>
pub fn local_addr(&self) -> AxResult<SocketAddr>
Returns the local address and port, or
Err(NotConnected)
if not connected.
sourcepub fn peer_addr(&self) -> AxResult<SocketAddr>
pub fn peer_addr(&self) -> AxResult<SocketAddr>
Returns the remote address and port, or
Err(NotConnected)
if not connected.
sourcepub fn is_nonblocking(&self) -> bool
pub fn is_nonblocking(&self) -> bool
Returns whether this socket is in nonblocking mode.
sourcepub fn set_nonblocking(&self, nonblocking: bool)
pub fn set_nonblocking(&self, nonblocking: bool)
Moves this TCP stream into or out of nonblocking mode.
This will result in read
, write
, recv
and send
operations
becoming nonblocking, i.e., immediately returning from their calls.
If the IO operation is successful, Ok
is returned and no further
action is required. If the IO operation could not be completed and needs
to be retried, an error with kind Err(WouldBlock)
is
returned.
sourcepub fn connect(&self, remote_addr: SocketAddr) -> AxResult
pub fn connect(&self, remote_addr: SocketAddr) -> AxResult
Connects to the given address and port.
The local port is generated automatically.
sourcepub fn bind(&self, local_addr: SocketAddr) -> AxResult
pub fn bind(&self, local_addr: SocketAddr) -> AxResult
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for TcpSocket
impl !RefUnwindSafe for TcpSocket
impl Send for TcpSocket
impl Unpin for TcpSocket
impl UnwindSafe for TcpSocket
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more