doc.rust-lang.org
pub fn ttl(&self) -> io::Result<u32>
Gets the value of the IP_TTL option for this socket.
method
std
Stable since 1.9.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn try_clone(&self) -> io::Result<UdpSocket>
Creates a new independently owned handle to the underlying socket.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn take_error(&self) -> io::Result<Option<io::Error>>
Gets the value of the SO_ERROR option on this socket.
method
std
Stable since 1.9.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn set_write_timeout(&self, dur: Option<Duration>) -> io::Result<()>
Sets the write timeout to the timeout specified.
method
std
Stable since 1.4.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn set_ttl(&self, ttl: u32) -> io::Result<()>
Sets the value for the IP_TTL option on this socket.
method
std
Stable since 1.9.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn set_read_timeout(&self, dur: Option<Duration>) -> io::Result<()>
Sets the read timeout to the timeout specified.
method
std
Stable since 1.4.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn set_nonblocking(&self, nonblocking: bool) -> io::Result<()>
Moves this UDP socket into or out of nonblocking mode.
method
std
Stable since 1.9.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn set_multicast_ttl_v4(&self, multicast_ttl_v4: u32) -> io::Result<()>
Sets the value of the IP_MULTICAST_TTL option for this socket.
method
std
Stable since 1.9.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn set_multicast_loop_v6(&self, multicast_loop_v6: bool) -> io::Result<()>
Sets the value of the IPV6_MULTICAST_LOOP option for this socket.
method
std
Stable since 1.9.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn set_multicast_loop_v4(&self, multicast_loop_v4: bool) -> io::Result<()>
Sets the value of the IP_MULTICAST_LOOP option for this socket.
method
std
Stable since 1.9.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn set_broadcast(&self, broadcast: bool) -> io::Result<()>
Sets the value of the SO_BROADCAST option for this socket.
method
std
Stable since 1.9.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn send_to<A>(&self, buf: &[u8], addr: A) -> io::Result<usize>
Sends data on the socket to the given address. On success, returns the number of bytes written. Note that the operating system may refuse buffers larger than 65507. However, partial writes are not possible until buffer sizes above i32::MAX.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn send(&self, buf: &[u8]) -> io::Result<usize>
Sends data on the socket to the remote address to which it is connected. On success, returns the number of bytes written. Note that the operating system may refuse buffers larger than 65507. However, partial writes are not possible until buffer sizes above i32::MAX.
method
std
Stable since 1.9.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn recv_from(&self, buf: &mut [u8]) -> io::Result<(usize, SocketAddr)>
Receives a single datagram message on the socket. On success, returns the number of bytes read and the origin.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn recv(&self, buf: &mut [u8]) -> io::Result<usize>
Receives a single datagram message on the socket from the remote address to which it is connected. On success, returns the number of bytes read.
method
std
Stable since 1.9.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn read_timeout(&self) -> io::Result<Option<Duration>>
Returns the read timeout of this socket.
method
std
Stable since 1.4.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn peer_addr(&self) -> io::Result<SocketAddr>
Returns the socket address of the remote peer this socket was connected to.
method
std
Stable since 1.40.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn peek_from(&self, buf: &mut [u8]) -> io::Result<(usize, SocketAddr)>
Receives a single datagram message on the socket, without removing it from the queue. On success, returns the number of bytes read and the origin.
method
std
Stable since 1.18.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn peek(&self, buf: &mut [u8]) -> io::Result<usize>
Receives single datagram on the socket from the remote address to which it is connected, without removing the message from input queue. On success, returns the number of bytes peeked.
method
std
Stable since 1.18.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn multicast_ttl_v4(&self) -> io::Result<u32>
Gets the value of the IP_MULTICAST_TTL option for this socket.
method
std
Stable since 1.9.0
Version 1.100.0-nightly