Trait sntpc::NtpUdpSocket
source · pub trait NtpUdpSocket {
// Required methods
fn send_to<T: ToSocketAddrs>(&self, buf: &[u8], addr: T) -> Result<usize>;
fn recv_from(&self, buf: &mut [u8]) -> Result<(usize, SocketAddr)>;
}
Expand description
A trait encapsulating UDP socket interface required for SNTP client operations
Required Methods§
sourcefn send_to<T: ToSocketAddrs>(&self, buf: &[u8], addr: T) -> Result<usize>
fn send_to<T: ToSocketAddrs>(&self, buf: &[u8], addr: T) -> Result<usize>
Send the given buffer to an address provided. On success, returns the number of bytes written.
Since multiple SocketAddr objects can hide behind the type (domain name can be
resolved to multiple addresses), the method should send data to a single address
available in addr
Object Safety§
This trait is not object safe.