Struct std::io::net::udp::UdpStreamDeprecated
[-]
[+]
[src]
pub struct UdpStream { // some fields omitted }
A type that allows convenient usage of a UDP stream connected to one
address via the Reader
and Writer
traits.
Note
This structure has been deprecated because Reader
is a stream-oriented API but UDP
is a packet-oriented protocol. Every Reader
method will read a whole packet and
throw all superfluous bytes away so that they are no longer available for further
method calls.
Methods
impl UdpStream
fn as_socket<T, F>(&mut self, f: F) -> T where F: FnOnce(&mut UdpSocket) -> T
Allows access to the underlying UDP socket owned by this stream. This is useful to, for example, use the socket to send data to hosts other than the one that this stream is connected to.
fn disconnect(self) -> UdpSocket
Consumes this UDP stream and returns out the underlying socket.
Trait Implementations
impl Reader for UdpStream
fn read(&mut self, buf: &mut [u8]) -> IoResult<uint>
Returns the next non-empty message from the specified address.