pub struct TcpSocket { /* private fields */ }Expand description
A TCP socket that has not yet been converted to a TcpStream or TcpListener
Implementations§
Source§impl TcpSocket
impl TcpSocket
Sourcepub async fn connect(self, addr: SocketAddr) -> Result<TcpStream>
pub async fn connect(self, addr: SocketAddr) -> Result<TcpStream>
Establishes a TCP connection with a peer at the specified socket address
Sourcepub fn bind(&self, addr: SocketAddr) -> Result<()>
pub fn bind(&self, addr: SocketAddr) -> Result<()>
Binds the socket to the given address
Sourcepub fn listen(self, backlog: u32) -> Result<TcpListener>
pub fn listen(self, backlog: u32) -> Result<TcpListener>
Converts the socket into a TcpListener
Sourcepub fn get_ref(&self) -> &TokioTcpSocket
pub fn get_ref(&self) -> &TokioTcpSocket
Retruns the reference for the internal socket
Auto Trait Implementations§
impl Freeze for TcpSocket
impl RefUnwindSafe for TcpSocket
impl Send for TcpSocket
impl Sync 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