Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 76993dd

Browse files
Revert "Fixes #652"
This reverts commit a4f6806
1 parent a4f6806 commit 76993dd

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

‎src/net/udp/mod.rs‎

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -244,12 +244,9 @@ impl UdpSocket {
244244
}))
245245
}
246246

247-
/// Sends data on the socket to the remote address to which it is connected.
248-
///
249-
/// The [`connect`] method will connect this socket to a remote address.
250-
/// This method will fail if the socket is not connected.
247+
/// Sends data on the socket to the given address.
251248
///
252-
/// [`connect`]: #method.connect
249+
/// On success, returns the number of bytes written.
253250
///
254251
/// # Examples
255252
///
@@ -300,11 +297,12 @@ impl UdpSocket {
300297
/// #
301298
/// use async_std::net::UdpSocket;
302299
///
303-
/// let socket = UdpSocket::bind("127.0.0.1:7878").await?;
300+
/// let socket = UdpSocket::bind("127.0.0.1:0").await?;
304301
/// socket.connect("127.0.0.1:8080").await?;
305-
/// let bytes = socket.send(b"Hi there!").await?;
306302
///
307-
/// println!("Sent {} bytes", bytes);
303+
/// let mut buf = vec![0; 1024];
304+
/// let n = socket.recv(&mut buf).await?;
305+
/// println!("Received {} bytes", n);
308306
/// #
309307
/// # Ok(()) }) }
310308
/// ```

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /