[][src]Module mdns::discover

Utilities for discovering devices on the LAN.

Examples

use futures_util::{pin_mut, stream::StreamExt};
use mdns::{Error, Record, RecordKind};
use std::time::Duration;

const SERVICE_NAME: &'static str = "_googlecast._tcp.local";

#[async_std::main]
async fn main() -> Result<(), Error> {
    let stream = mdns::discover::all(SERVICE_NAME, Duration::from_secs(15))?.listen();
    pin_mut!(stream);

    while let Some(Ok(response)) = stream.next().await {
        println!("{:?}", response);
    }

    Ok(())
}

Structs

Discovery

A multicast DNS discovery request.

Functions

all

Gets an iterator over all responses for a given service on all interfaces.

interface

Gets an iterator over all responses for a given service on a given interface.