pub struct TcpConn { /* private fields */ }
Methods from Deref<Target = TcpStream>§
Sourcepub fn local_addr(&self) -> Result<SocketAddr, Error>
pub fn local_addr(&self) -> Result<SocketAddr, Error>
Return the local address that this stream is bound to.
Sourcepub fn peer_addr(&self) -> Result<SocketAddr, Error>
pub fn peer_addr(&self) -> Result<SocketAddr, Error>
Return the remote address that this stream is connected to.
Sourcepub fn nodelay(&self) -> Result<bool, Error>
pub fn nodelay(&self) -> Result<bool, Error>
Get the value of the TCP_NODELAY
option on this socket.
Sourcepub fn set_nodelay(&self, nodelay: bool) -> Result<(), Error>
pub fn set_nodelay(&self, nodelay: bool) -> Result<(), Error>
Set the value of the TCP_NODELAY
option on this socket.
Sourcepub fn set_tcp_keepalive(
&self,
time: Option<Duration>,
interval: Option<Duration>,
retries: Option<u32>,
) -> Result<(), Error>
pub fn set_tcp_keepalive( &self, time: Option<Duration>, interval: Option<Duration>, retries: Option<u32>, ) -> Result<(), Error>
Set the value of the SO_KEEPALIVE
option on this socket.
Sourcepub async fn readable(&self, relaxed: bool) -> Result<(), Error>
pub async fn readable(&self, relaxed: bool) -> Result<(), Error>
Wait for read readiness. Note: Do not use it before every io. It is different from other runtimes!
Everytime call to this method may pay a syscall cost. In uring impl, it will push a PollAdd op; in epoll impl, it will use use inner readiness state; if !relaxed, it will call syscall poll after that.
If relaxed, on legacy driver it may return false positive result. If you want to do io by your own, you must maintain io readiness and wait for io ready with relaxed=false.
Sourcepub async fn writable(&self, relaxed: bool) -> Result<(), Error>
pub async fn writable(&self, relaxed: bool) -> Result<(), Error>
Wait for write readiness. Note: Do not use it before every io. It is different from other runtimes!
Everytime call to this method may pay a syscall cost. In uring impl, it will push a PollAdd op; in epoll impl, it will use use inner readiness state; if !relaxed, it will call syscall poll after that.
If relaxed, on legacy driver it may return false positive result. If you want to do io by your own, you must maintain io readiness and wait for io ready with relaxed=false.