[][src]Function ether_dream::recv_dac_broadcasts

pub fn recv_dac_broadcasts() -> Result<RecvDacBroadcasts>

Produces an iterator that listens and waits for broadcast messages from DACs on the network and yields them as they are received on the inner UDP socket.

This function returns an io::Error if it could not bind to the broadcast address 255.255.255.255:<protocol::BROADCAST_PORT>.

The produced iterator yields an io::Error if:

  • An error occurred when receiving on the inner UDP socket.
  • A DacBroadcast could not be read from the received bytes.

Example

extern crate ether_dream;

fn main() {
    let dac_broadcasts = ether_dream::recv_dac_broadcasts().expect("failed to bind to UDP socket");
    for dac_broadcast in dac_broadcasts {
        println!("{:#?}", dac_broadcast);
    }
}