Skip to content

Commit

Permalink
net: add UdpSocket readiness and non-blocking ops
Browse files Browse the repository at this point in the history
Adds `ready()`, `readable()`, and `writable()` async methods for waiting
for socket readiness. Adds `try_send`, `try_send_to`, `try_recv`, and
`try_recv_from` for performing non-blocking operations on the socket.

This is the UDP equivalent of #3130.
  • Loading branch information
carllerche committed Nov 13, 2020
1 parent 02b1117 commit 0721cc5
Show file tree
Hide file tree
Showing 3 changed files with 528 additions and 78 deletions.
5 changes: 2 additions & 3 deletions tokio/src/net/tcp/stream.rs
Expand Up @@ -374,7 +374,7 @@ impl TcpStream {
/// If data is successfully read, `Ok(n)` is returned, where `n` is the
/// number of bytes read. `Ok(n)` indicates the stream's read half is closed
/// and will no longer yield data. If the stream is not ready to read data
/// `Err(io::ErrorKinid::WouldBlock)` is returned.
/// `Err(io::ErrorKind::WouldBlock)` is returned.
///
/// # Examples
///
Expand Down Expand Up @@ -473,8 +473,7 @@ impl TcpStream {
/// The function will attempt to write the entire contents of `buf`, but
/// only part of the buffer may be written.
///
/// This function is equivalent to `ready(Interest::WRITABLE)` is usually
/// paired with `try_write()`.
/// This function is usually paired with `writable()`
///
/// # Return
///
Expand Down

0 comments on commit 0721cc5

Please sign in to comment.