Add recvfrom and sendto.
We leave them for compatibility, but mark them as deprecated. Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
This commit is contained in:
parent
dfdce47988
commit
55f5a1ef59
1 changed files with 13 additions and 0 deletions
|
|
@ -82,6 +82,13 @@ impl UdpSocket {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(missing_doc)]
|
||||
#[deprecated = "renamed to `recv_from`"]
|
||||
pub fn recvfrom(&mut self, buf: &mut [u8])
|
||||
-> IoResult<(uint, SocketAddr)> {
|
||||
self.recv_from(buf)
|
||||
}
|
||||
|
||||
/// Sends data on the socket to the given address. Returns nothing on
|
||||
/// success.
|
||||
pub fn send_to(&mut self, buf: &[u8], dst: SocketAddr) -> IoResult<()> {
|
||||
|
|
@ -91,6 +98,12 @@ impl UdpSocket {
|
|||
}).map_err(IoError::from_rtio_error)
|
||||
}
|
||||
|
||||
#[allow(missing_doc)]
|
||||
#[deprecated = "renamed to `send_to`"]
|
||||
pub fn sendto(&mut self, buf: &[u8], dst: SocketAddr) -> IoResult<()> {
|
||||
self.send_to(buf, dst)
|
||||
}
|
||||
|
||||
/// Creates a `UdpStream`, which allows use of the `Reader` and `Writer`
|
||||
/// traits to receive and send data from the same address. This transfers
|
||||
/// ownership of the socket to the stream.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue