This reverts commit a4f68066
This commit is contained in:
noah 2020-01-14 10:55:10 -06:00
parent a4f6806605
commit 76993dd755

View file

@ -244,12 +244,9 @@ impl UdpSocket {
})) }))
} }
/// Sends data on the socket to the remote address to which it is connected. /// Sends data on the socket to the given address.
/// ///
/// The [`connect`] method will connect this socket to a remote address. /// On success, returns the number of bytes written.
/// This method will fail if the socket is not connected.
///
/// [`connect`]: #method.connect
/// ///
/// # Examples /// # Examples
/// ///
@ -300,11 +297,12 @@ impl UdpSocket {
/// # /// #
/// use async_std::net::UdpSocket; /// use async_std::net::UdpSocket;
/// ///
/// let socket = UdpSocket::bind("127.0.0.1:7878").await?; /// let socket = UdpSocket::bind("127.0.0.1:0").await?;
/// socket.connect("127.0.0.1:8080").await?; /// socket.connect("127.0.0.1:8080").await?;
/// let bytes = socket.send(b"Hi there!").await?;
/// ///
/// println!("Sent {} bytes", bytes); /// let mut buf = vec![0; 1024];
/// let n = socket.recv(&mut buf).await?;
/// println!("Received {} bytes", n);
/// # /// #
/// # Ok(()) }) } /// # Ok(()) }) }
/// ``` /// ```