Struct resolve::socket::DnsSocket
[−]
[src]
pub struct DnsSocket { /* fields omitted */ }
Represents a socket transmitting DNS messages.
Methods
impl DnsSocket
[src]
fn new() -> Result<DnsSocket>
[src]
Returns a DnsSocket
, bound to an unspecified address.
fn bind<A: ToSocketAddrs>(addr: A) -> Result<DnsSocket>
[src]
Returns a DnsSocket
, bound to the given address.
fn get(&self) -> &UdpSocket
[src]
Returns a reference to the wrapped UdpSocket
.
fn send_message<A: ToSocketAddrs>(
&self,
message: &Message,
addr: A
) -> Result<(), Error>
[src]
&self,
message: &Message,
addr: A
) -> Result<(), Error>
Sends a message to the given address.
fn recv_from<'buf>(
&self,
buf: &'buf mut [u8]
) -> Result<(Message<'buf>, SocketAddr), Error>
[src]
&self,
buf: &'buf mut [u8]
) -> Result<(Message<'buf>, SocketAddr), Error>
Receives a message, returning the address of the sender. The given buffer is used to store and parse message data.
The buffer should be exactly MESSAGE_LIMIT
bytes in length.
fn recv_message<'buf>(
&self,
addr: &SocketAddr,
buf: &'buf mut [u8]
) -> Result<Option<Message<'buf>>, Error>
[src]
&self,
addr: &SocketAddr,
buf: &'buf mut [u8]
) -> Result<Option<Message<'buf>>, Error>
Attempts to read a DNS message. The message will only be decoded if the
remote address matches addr
. If a packet is received from a non-matching
address, the message is not decoded and Ok(None)
is returned.
The buffer should be exactly MESSAGE_LIMIT
bytes in length.