keepsimple1 / mdns-sd

Rust library for mDNS based Service Discovery
Apache License 2.0
96 stars 37 forks source link

Searching for a service returns some internal responses but does not forward anything to listener #230

Closed GunnarMorrigan closed 3 months ago

GunnarMorrigan commented 3 months ago

Hi,

I am trying to search for a service and the service does provide several responses to the query. However, the application never yields these to the listener. Can i access some of these responses some how?

ue }, ttl: 120, created: 1718868655990, expires: 1718868775990, refresh: 1718868751990 }, alias: "service_name_here.local." }
2024-06-20T07:30:55.991442Z DEBUG mdns_sd::dns_parser: 1213: DnsAddress { record: DnsRecord { entry: DnsEntry { name: "service_name_here.local.", ty: 1, class: 1, cache_flush: true }, ttl: 120, created: 1718868655991, expires: 1718868775991, refresh: 1718868751991 }, address: 192.168.1.29 }
2024-06-20T07:30:55.991997Z DEBUG mdns_sd::service_daemon: 1624: handle_response: 2 answers 0 authorities 0 additionals
2024-06-20T07:30:55.992919Z DEBUG mdns_sd::service_daemon: 2451: FLUSH one record: DnsAddress { record: DnsRecord { entry: DnsEntry { name: "service_name_here.local.", ty: 1, class: 1, cache_flush: true }, ttl: 120, created: 1718868654801, expires: 1718868774801, refresh: 1718868750801 }, address: 192.168.1.29 }
2024-06-20T07:30:55.995023Z TRACE polling::iocp: 201: modify: handle=IoCompletionPort { handle: 000000012c }, sock=444, ev=Event { key: 0, readable: true, writable: false }
2024-06-20T07:30:55.995612Z TRACE polling: 499: Poller::wait(_, Some(6.759s))
2024-06-20T07:30:55.996429Z TRACE polling::iocp: 258: wait: handle=IoCompletionPort { handle: 000000012c }, timeout=Some(6.759s)
2024-06-20T07:30:56.807907Z TRACE polling::iocp: 285: new events: handle=IoCompletionPort { handle: 000000012c }, len=1    
2024-06-20T07:30:56.808750Z DEBUG mdns_sd::service_daemon: 418: event received with key 0
2024-06-20T07:30:56.809171Z DEBUG mdns_sd::service_daemon: 1422: received 165 bytes from IP: 192.168.1.84
2024-06-20T07:30:56.809558Z DEBUG mdns_sd::dns_parser: 1050: read_header: id 0, 0 questions 5 answers 0 authorities 0 additionals
2024-06-20T07:30:56.810004Z DEBUG mdns_sd::dns_parser: 1062: read_questions: 0
2024-06-20T07:30:56.810946Z DEBUG mdns_sd::dns_parser: 1088: read_others: 5
2024-06-20T07:30:56.811504Z DEBUG mdns_sd::dns_parser: 1213: DnsTxt { record: DnsRecord { entry: DnsEntry { name: "service_name_here._ssh._tcp.local.", ty: 16, class: 1, cache_flush: true }, ttl: 4500, created: 1718868656811, expires: 1718873156811, refresh: 1718872256811 }, text: [0] }
2024-06-20T07:30:56.812326Z DEBUG mdns_sd::dns_parser: 1213: DnsPointer { record: DnsRecord { entry: DnsEntry { name: "_ssh._tcp.local.", ty: 12, class: 1, cache_flush: false }, ttl: 4500, created: 1718868656812, expires: 1718873156812, refresh: 1718872256812 }, alias: "service_name_here._ssh._tcp.local." }
2024-06-20T07:30:56.813005Z DEBUG mdns_sd::dns_parser: 1213: DnsSrv { record: DnsRecord { entry: DnsEntry { name: "service_name_here._ssh._tcp.local.", ty: 33, class: 1, cache_flush: true }, ttl: 120, created: 1718868656812, expires: 1718868776812, refresh: 1718868752812 }, priority: 0, weight: 0, host: "service_name_here.local.", port: 22 }
2024-06-20T07:30:56.813656Z DEBUG mdns_sd::dns_parser: 1213: DnsAddress { record: DnsRecord { entry: DnsEntry { name: "service_name_here.local.", ty: 1, class: 1, cache_flush: true }, ttl: 120, created: 1718868656813, expires: 1718868776813, refresh: 1718868752813 }, address: 192.168.1.29 }
2024-06-20T07:30:56.814483Z DEBUG mdns_sd::dns_parser: 1213: DnsPointer { record: DnsRecord { entry: DnsEntry { name: "_services._dns-sd._udp.local.", ty: 12, class: 1, cache_flush: false }, ttl: 4500, created: 1718868656814, expires: 1718873156814, refresh: 1718872256814 }, alias: "_ssh._tcp.local." }
2024-06-20T07:30:56.815199Z DEBUG mdns_sd::service_daemon: 1624: handle_response: 5 answers 0 authorities 0 additionals
2024-06-20T07:30:56.815643Z DEBUG mdns_sd::service_daemon: 2451: FLUSH one record: DnsTxt { record: DnsRecord { entry: DnsEntry { name: "service_name_here._ssh._tcp.local.", ty: 16, class: 1, cache_flush: true }, ttl: 4500, created: 1718868654800, expires: 1718873154800, refresh: 1718872254800 }, text: [0] }
2024-06-20T07:30:56.816370Z DEBUG mdns_sd::service_daemon: 2451: FLUSH one record: DnsSrv { record: DnsRecord { entry: DnsEntry { name: "service_name_here._ssh._tcp.local.", ty: 33, class: 1, cache_flush: true }, ttl: 120, created: 1718868654807, expires: 1718868774807, refresh: 1718868750807 }, priority: 0, weight: 0, host: "service_name_here.local.", port: 22 }
2024-06-20T07:30:56.817318Z DEBUG mdns_sd::service_daemon: 1422: received 154 bytes from IP: 192.168.1.84
2024-06-20T07:30:56.817708Z DEBUG mdns_sd::dns_parser: 1050: read_header: id 0, 0 questions 4 answers 0 authorities 0 additionals
2024-06-20T07:30:56.818146Z DEBUG mdns_sd::dns_parser: 1062: read_questions: 0
2024-06-20T07:30:56.818532Z DEBUG mdns_sd::dns_parser: 1088: read_others: 4
2024-06-20T07:30:56.819027Z DEBUG mdns_sd::dns_parser: 1213: DnsTxt { record: DnsRecord { entry: DnsEntry { name: "service_name_here._sftp-ssh._tcp.local.", ty: 16, class: 1, cache_flush: true }, ttl: 4500, created: 1718868656819, expires: 1718873156819, refresh: 1718872256819 }, text: [0] }
2024-06-20T07:30:56.819824Z DEBUG mdns_sd::dns_parser: 1213: DnsPointer { record: DnsRecord { entry: DnsEntry { name: "_sftp-ssh._tcp.local.", ty: 12, class: 1, cache_flush: false }, ttl: 4500, created: 1718868656819, expires: 1718873156819, refresh: 1718872256819 }, alias: "service_name_here._sftp-ssh._tcp.local." }
2024-06-20T07:30:56.820567Z DEBUG mdns_sd::dns_parser: 1213: DnsSrv { record: DnsRecord { entry: DnsEntry { name: "service_name_here._sftp-ssh._tcp.local.", ty: 33, class: 1, cache_flush: true }, ttl: 120, created: 1718868656820, expires: 1718868776820, refresh: 1718868752820 }, priority: 0, weight: 0, host: "service_name_here.local.", port: 22 }
2024-06-20T07:30:56.821313Z DEBUG mdns_sd::dns_parser: 1213: DnsPointer { record: DnsRecord { entry: DnsEntry { name: "_services._dns-sd._udp.local.", ty: 12, class: 1, cache_flush: false }, ttl: 4500, created: 1718868656821, expires: 1718873156821, refresh: 1718872256821 }, alias: "_sftp-ssh._tcp.local." }
2024-06-20T07:30:56.822345Z DEBUG mdns_sd::service_daemon: 1624: handle_response: 4 answers 0 authorities 0 additionals
2024-06-20T07:30:56.822861Z DEBUG mdns_sd::service_daemon: 2451: FLUSH one record: DnsTxt { record: DnsRecord { entry: DnsEntry { name: "service_name_here._sftp-ssh._tcp.local.", ty: 16, class: 1, cache_flush: true }, ttl: 4500, created: 1718868654805, expires: 1718873154805, refresh: 1718872254805 }, text: [0] }
2024-06-20T07:30:56.823604Z DEBUG mdns_sd::service_daemon: 2451: FLUSH one record: DnsSrv { record: DnsRecord { entry: DnsEntry { name: "service_name_here._sftp-ssh._tcp.local.", ty: 33, class: 1, cache_flush: true }, ttl: 120, created: 1718868654805, expires: 1718868774805, refresh: 1718868750805 }, priority: 0, weight: 0, host: "service_name_here.local.", port: 22 }
2024-06-20T07:30:56.824686Z DEBUG mdns_sd::service_daemon: 1422: received 144 bytes from IP: 192.168.1.84
2024-06-20T07:30:56.825149Z DEBUG mdns_sd::dns_parser: 1050: read_header: id 0, 0 questions 3 answers 0 authorities 0 additionals
2024-06-20T07:30:56.825670Z DEBUG mdns_sd::dns_parser: 1062: read_questions: 0
2024-06-20T07:30:56.826116Z DEBUG mdns_sd::dns_parser: 1088: read_others: 3
2024-06-20T07:30:56.826644Z DEBUG mdns_sd::dns_parser: 1213: DnsTxt { record: DnsRecord { entry: DnsEntry { name: "service_name_here._other._tcp.local.", ty: 16, class: 1, cache_flush: true }, ttl: 4500, created: 1718868656826, expires: 1718873156826, refresh: 1718872256826 }, text: [6, 83, 67, 71, 45, 67, 85] }
2024-06-20T07:30:56.828295Z DEBUG mdns_sd::dns_parser: 1213: DnsSrv { record: DnsRecord { entry: DnsEntry { name: "service_name_here._other._tcp.local.", ty: 33, class: 1, cache_flush: true }, ttl: 120, created: 1718868656828, expires: 1718868776828, refresh: 1718868752828 }, priority: 0, weight: 0, host: "service_name_here.local.", port: 5080 }
2024-06-20T07:30:56.830131Z DEBUG mdns_sd::dns_parser: 1213: DnsPointer { record: DnsRecord { entry: DnsEntry { name: "_services._dns-sd._udp.local.", ty: 12, class: 1, cache_flush: false }, ttl: 4500, created: 1718868656830, expires: 1718873156830, refresh: 1718872256830 }, alias: "_other._tcp.local." }
2024-06-20T07:30:56.830817Z DEBUG mdns_sd::service_daemon: 1624: handle_response: 3 answers 0 authorities 0 additionals
2024-06-20T07:30:56.831398Z DEBUG mdns_sd::service_daemon: 2451: FLUSH one record: DnsTxt { record: DnsRecord { entry: DnsEntry { name: "service_name_here._other._tcp.local.", ty: 16, class: 1, cache_flush: true }, ttl: 4500, created: 1718868654802, expires: 1718873154802, refresh: 1718872254802 }, text: [6, 83, 67, 71, 45, 67, 85] }
2024-06-20T07:30:56.832204Z DEBUG mdns_sd::service_daemon: 2451: FLUSH one record: DnsSrv { record: DnsRecord { entry: DnsEntry { name: "service_name_here._other._tcp.local.", ty: 33, class: 1, cache_flush: true }, ttl: 120, created: 1718868654801, expires: 1718868774801, refresh: 1718868750801 }, priority: 0, weight: 0, host: "service_name_here.local.", port: 5080 }
2024-06-20T07:30:56.833156Z DEBUG mdns_sd::service_daemon: 1422: received 203 bytes from IP: 192.168.1.84
2024-06-20T07:30:56.833603Z DEBUG mdns_sd::dns_parser: 1050: read_header: id 0, 0 questions 5 answers 0 authorities 0 additionals
2024-06-20T07:30:56.833990Z DEBUG mdns_sd::dns_parser: 1062: read_questions: 0
2024-06-20T07:30:56.834457Z DEBUG mdns_sd::dns_parser: 1088: read_others: 5
2024-06-20T07:30:56.835013Z DEBUG mdns_sd::dns_parser: 1213: DnsTxt { record: DnsRecord { entry: DnsEntry { name: "service_name_here._block._tcp.local.", ty: 16, class: 1, cache_flush: true }, ttl: 4500, created: 1718868656834, expires: 1718873156834, refresh: 1718872256834 }, text: [8, 66, 76, 79, 81, 66, 65, 83, 69] }
2024-06-20T07:30:56.835812Z DEBUG mdns_sd::dns_parser: 1213: DnsPointer { record: DnsRecord { entry: DnsEntry { name: "_block._tcp.local.", ty: 12, class: 1, cache_flush: false }, ttl: 4500, created: 1718868656835, expires: 1718873156835, refresh: 1718872256835 }, alias: "service_name_here._block._tcp.local." }
2024-06-20T07:30:56.836440Z DEBUG mdns_sd::dns_parser: 1213: DnsSrv { record: DnsRecord { entry: DnsEntry { name: "service_name_here._block._tcp.local.", ty: 33, class: 1, cache_flush: true }, ttl: 120, created: 1718868656836, expires: 1718868776836, refresh: 1718868752836 }, priority: 0, weight: 0, host: "service_name_here.local.", port: 22 }
2024-06-20T07:30:56.837244Z DEBUG mdns_sd::dns_parser: 1213: DnsPointer { record: DnsRecord { entry: DnsEntry { name: "_services._dns-sd._udp.local.", ty: 12, class: 1, cache_flush: false }, ttl: 4500, created: 1718868656837, expires: 1718873156837, refresh: 1718872256837 }, alias: "_block._tcp.local." }
2024-06-20T07:30:56.837964Z DEBUG mdns_sd::dns_parser: 1213: DnsPointer { record: DnsRecord { entry: DnsEntry { name: "_other._tcp.local.", ty: 12, class: 1, cache_flush: false }, ttl: 4500, created: 1718868656837, expires: 1718873156837, refresh: 1718872256837 }, alias: "service_name_here._other._tcp.local." }
2024-06-20T07:30:56.838608Z DEBUG mdns_sd::service_daemon: 1624: handle_response: 5 answers 0 authorities 0 additionals
2024-06-20T07:30:56.838968Z DEBUG mdns_sd::service_daemon: 2451: FLUSH one record: DnsTxt { record: DnsRecord { entry: DnsEntry { name: "service_name_here._block._tcp.local.", ty: 16, class: 1, cache_flush: true }, ttl: 4500, created: 1718868654813, expires: 1718873154813, refresh: 1718872254813 }, text: [8, 66, 76, 79, 81, 66, 65, 83, 69] }
2024-06-20T07:30:56.839822Z DEBUG mdns_sd::service_daemon: 2451: FLUSH one record: DnsSrv { record: DnsRecord { entry: DnsEntry { name: "service_name_here._block._tcp.local.", ty: 33, class: 1, cache_flush: true }, ttl: 120, created: 1718868654814, expires: 1718868774814, refresh: 1718868750814 }, priority: 0, weight: 0, host: "service_name_here.local.", port: 22 }
keepsimple1 commented 3 months ago

I assume the log is from the client (querier) side ServiceDaemon. Normally I would expected to see at least service found message. Can you share how you called ServiceDaemon::browse() ?

GunnarMorrigan commented 3 months ago

Hi @keepsimple1,

Thank you for the response. I have just copied the example code.

    let targets = tracing_subscriber::filter::Targets::new()
        .with_target("fp_connect_gui", tracing::metadata::LevelFilter::TRACE)
        .with_default(tracing::metadata::LevelFilter::TRACE);

    let mut fmt_layer = tracing_subscriber::fmt::layer()
        .with_target(true)
        .with_level(true)
        .with_line_number(true)
        .with_ansi(false);

    fmt_layer.set_ansi(false);

    tracing_subscriber::registry()
        .with(fmt_layer)
        .with(targets)
        .init();

    // Create a daemon
    let mdns = ServiceDaemon::new().expect("Failed to create daemon");

    // Browse for a service type.
    let receiver = mdns.browse(SERVICE_NAME).expect("Failed to browse");
    // let monitor = mdns.monitor().expect("Failed to monitor");

    // Receive the browse events in sync or async. Here is
    // an example of using a thread. Users can call `receiver.recv_async().await`
    // if running in async environment.
    std::thread::spawn(move || {
        while let Ok(event) = receiver.recv() {
            match event {
                ServiceEvent::ServiceResolved(info) => {
                    println!("Resolved a new service: {}", info.get_fullname());
                }
                other_event => {
                    println!("Received other event: {:?}", &other_event);
                }
            }
        }
    });
    // std::thread::spawn(move || {
    //     while let Ok(event) = monitor.recv() {
    //         dbg!(event);
    //     }
    // });

    // Gracefully shutdown the daemon.
    std::thread::sleep(std::time::Duration::from_secs(3600));
    mdns.shutdown().unwrap();
keepsimple1 commented 3 months ago

let receiver = mdns.browse(SERVICE_NAME).expect("Failed to browse");

What SERVICE_NAME is used here? I cannot see that in the previous debug log. I was trying to look for this line: https://github.com/keepsimple1/mdns-sd/blob/5ca98cb683bf93bc103656e36000e2b0c6bcaae6/src/service_daemon.rs#L1378

but cannot find it in your debug log either. Was the log collected on the querier side?

GunnarMorrigan commented 3 months ago

He @keepsimple1,

This is a full log from one search and one reply on the last line you can see the next search starting:

2024-06-24T09:40:09.447346Z TRACE polling::iocp: 111: new: handle=IoCompletionPort { handle: 0000000130 }    
2024-06-24T09:40:09.458064Z DEBUG mdns_sd::service_daemon: 742: new socket bind to [::]:5353    
2024-06-24T09:40:09.460298Z DEBUG mdns_sd::service_daemon: 742: new socket bind to [::]:5353    
2024-06-24T09:40:09.461515Z DEBUG mdns_sd::service_daemon: 742: new socket bind to 0.0.0.0:5353    
2024-06-24T09:40:09.463321Z DEBUG mdns_sd::service_daemon: 742: new socket bind to [::]:5353    
2024-06-24T09:40:09.464465Z DEBUG mdns_sd::service_daemon: 742: new socket bind to [::]:5353    
2024-06-24T09:40:09.466270Z DEBUG mdns_sd::service_daemon: 742: new socket bind to 0.0.0.0:5353    
2024-06-24T09:40:09.468616Z DEBUG mdns_sd::service_daemon: 742: new socket bind to [::]:5353    
2024-06-24T09:40:09.469539Z DEBUG mdns_sd::service_daemon: 742: new socket bind to 0.0.0.0:5353    
2024-06-24T09:40:09.471765Z DEBUG mdns_sd::service_daemon: 742: new socket bind to [::]:5353    
2024-06-24T09:40:09.473114Z DEBUG mdns_sd::service_daemon: 742: new socket bind to 0.0.0.0:5353
2024-06-24T09:40:09.475690Z DEBUG mdns_sd::service_daemon: 742: new socket bind to [::]:5353    
2024-06-24T09:40:09.476717Z DEBUG mdns_sd::service_daemon: 742: new socket bind to 0.0.0.0:5353    
2024-06-24T09:40:09.478835Z TRACE polling::iocp: 141: add: handle=IoCompletionPort { handle: 0000000130 }, sock=300, ev=Event { key: 18446744073709551614, readable: true, writable: false }    
2024-06-24T09:40:09.479909Z TRACE polling::iocp: 141: add: handle=IoCompletionPort { handle: 0000000130 }, sock=444, ev=Event { key: 0, readable: true, writable: false }    
2024-06-24T09:40:09.480569Z TRACE polling::iocp: 141: add: handle=IoCompletionPort { handle: 0000000130 }, sock=448, ev=Event { key: 1, readable: true, writable: false }    
2024-06-24T09:40:09.481270Z TRACE polling::iocp: 141: add: handle=IoCompletionPort { handle: 0000000130 }, sock=420, ev=Event { key: 2, readable: true, writable: false }    
2024-06-24T09:40:09.482055Z TRACE polling::iocp: 141: add: handle=IoCompletionPort { handle: 0000000130 }, sock=424, ev=Event { key: 3, readable: true, writable: false }    
2024-06-24T09:40:09.482747Z TRACE polling::iocp: 141: add: handle=IoCompletionPort { handle: 0000000130 }, sock=436, ev=Event { key: 4, readable: true, writable: false }    
2024-06-24T09:40:09.483410Z TRACE polling::iocp: 141: add: handle=IoCompletionPort { handle: 0000000130 }, sock=456, ev=Event { key: 5, readable: true, writable: false }    
2024-06-24T09:40:09.484128Z TRACE polling::iocp: 141: add: handle=IoCompletionPort { handle: 0000000130 }, sock=440, ev=Event { key: 6, readable: true, writable: false }    
2024-06-24T09:40:09.485073Z TRACE polling::iocp: 141: add: handle=IoCompletionPort { handle: 0000000130 }, sock=452, ev=Event { key: 7, readable: true, writable: false }    
2024-06-24T09:40:09.486237Z TRACE polling::iocp: 141: add: handle=IoCompletionPort { handle: 0000000130 }, sock=432, ev=Event { key: 8, readable: true, writable: false }    
2024-06-24T09:40:09.487268Z TRACE polling::iocp: 141: add: handle=IoCompletionPort { handle: 0000000130 }, sock=468, ev=Event { key: 9, readable: true, writable: false }    
2024-06-24T09:40:09.487986Z TRACE polling::iocp: 141: add: handle=IoCompletionPort { handle: 0000000130 }, sock=428, ev=Event { key: 10, readable: true, writable: false }    
2024-06-24T09:40:09.488391Z TRACE polling::iocp: 141: add: handle=IoCompletionPort { handle: 0000000130 }, sock=464, ev=Event { key: 11, readable: true, writable: false }    
2024-06-24T09:40:09.488823Z TRACE polling: 499: Poller::wait(_, Some(30s))    
2024-06-24T09:40:09.489182Z TRACE polling::iocp: 258: wait: handle=IoCompletionPort { handle: 0000000130 }, timeout=Some(30s)    
2024-06-24T09:40:09.489763Z TRACE polling::iocp: 285: new events: handle=IoCompletionPort { handle: 0000000130 }, len=5    
2024-06-24T09:40:09.490212Z DEBUG mdns_sd::service_daemon: 418: event received with key 18446744073709551614    
2024-06-24T09:40:09.490906Z DEBUG mdns_sd::service_daemon: 1954: signal socket recvd: Command Browse    
2024-06-24T09:40:09.492001Z TRACE polling::iocp: 201: modify: handle=IoCompletionPort { handle: 0000000130 }, sock=300, ev=Event { key: 18446744073709551614, readable: true, writable: false }    
2024-06-24T09:40:09.492604Z DEBUG mdns_sd::service_daemon: 418: event received with key 1    
2024-06-24T09:40:09.493325Z DEBUG mdns_sd::service_daemon: 1422: received 12 bytes from IP: 192.168.1.84    
2024-06-24T09:40:09.494026Z DEBUG mdns_sd::dns_parser: 1050: read_header: id 0, 0 questions 0 answers 0 authorities 0 additionals    
2024-06-24T09:40:09.494647Z DEBUG mdns_sd::dns_parser: 1062: read_questions: 0    
2024-06-24T09:40:09.495258Z DEBUG mdns_sd::dns_parser: 1088: read_others: 0    
2024-06-24T09:40:09.496054Z TRACE polling::iocp: 201: modify: handle=IoCompletionPort { handle: 0000000130 }, sock=448, ev=Event { key: 1, readable: true, writable: false }    
2024-06-24T09:40:09.496753Z DEBUG mdns_sd::service_daemon: 418: event received with key 5    
2024-06-24T09:40:09.497393Z DEBUG mdns_sd::service_daemon: 1422: received 12 bytes from IP: 172.17.176.1    
2024-06-24T09:40:09.498035Z DEBUG mdns_sd::dns_parser: 1050: read_header: id 0, 0 questions 0 answers 0 authorities 0 additionals    
2024-06-24T09:40:09.498448Z DEBUG mdns_sd::dns_parser: 1062: read_questions: 0    
2024-06-24T09:40:09.498926Z DEBUG mdns_sd::dns_parser: 1088: read_others: 0    
2024-06-24T09:40:09.499623Z TRACE polling::iocp: 201: modify: handle=IoCompletionPort { handle: 0000000130 }, sock=456, ev=Event { key: 5, readable: true, writable: false }    
2024-06-24T09:40:09.499983Z DEBUG mdns_sd::service_daemon: 418: event received with key 6    
2024-06-24T09:40:09.500575Z DEBUG mdns_sd::service_daemon: 1422: received 12 bytes from IP: 100.88.63.87    
2024-06-24T09:40:09.501113Z DEBUG mdns_sd::dns_parser: 1050: read_header: id 0, 0 questions 0 answers 0 authorities 0 additionals    
2024-06-24T09:40:09.501678Z DEBUG mdns_sd::dns_parser: 1062: read_questions: 0    
2024-06-24T09:40:09.502165Z DEBUG mdns_sd::dns_parser: 1088: read_others: 0    
2024-06-24T09:40:09.502819Z TRACE polling::iocp: 201: modify: handle=IoCompletionPort { handle: 0000000130 }, sock=440, ev=Event { key: 6, readable: true, writable: false }    
2024-06-24T09:40:09.503266Z DEBUG mdns_sd::service_daemon: 418: event received with key 9    
2024-06-24T09:40:09.503677Z DEBUG mdns_sd::service_daemon: 1422: received 12 bytes from IP: 172.24.80.1    
2024-06-24T09:40:09.504447Z DEBUG mdns_sd::dns_parser: 1050: read_header: id 0, 0 questions 0 answers 0 authorities 0 additionals    
2024-06-24T09:40:09.504812Z DEBUG mdns_sd::dns_parser: 1062: read_questions: 0    
2024-06-24T09:40:09.505378Z DEBUG mdns_sd::dns_parser: 1088: read_others: 0    
2024-06-24T09:40:09.506326Z TRACE polling::iocp: 201: modify: handle=IoCompletionPort { handle: 0000000130 }, sock=468, ev=Event { key: 9, readable: true, writable: false }    
2024-06-24T09:40:09.508279Z DEBUG mdns_sd::service_daemon: 1378: Sending multicast queries: [("_device-name._tcp.local", 12)]    
2024-06-24T09:40:09.509610Z DEBUG mdns_sd::service_daemon: 2789: Broadcasting query: 1 questions 0 answers 0 authorities 0 additional    
2024-06-24T09:40:09.510599Z DEBUG mdns_sd::service_daemon: 2826: sent out 36 bytes on interface Interface { name: "{7702AA1D-10D3-430F-B1EB-3A9CF4BCB37F}", addr: V6(Ifv6Addr { ip: fe80::4ca4:4fa5:713b:13c8, netmask: ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff, broadcast: None }), index: Some(26) }    
2024-06-24T09:40:09.511774Z DEBUG mdns_sd::service_daemon: 2789: Broadcasting query: 1 questions 0 answers 0 authorities 0 additional    
2024-06-24T09:40:09.513609Z DEBUG mdns_sd::service_daemon: 2826: sent out 36 bytes on interface Interface { name: "{7702AA1D-10D3-430F-B1EB-3A9CF4BCB37F}", addr: V4(Ifv4Addr { ip: 192.168.1.84, netmask: 255.255.255.0, broadcast: Some(192.168.1.255) }), index: Some(26) }    
2024-06-24T09:40:09.513817Z DEBUG mdns_sd::service_daemon: 2789: Broadcasting query: 1 questions 0 answers 0 authorities 0 additional    
2024-06-24T09:40:09.514417Z DEBUG mdns_sd::service_daemon: 2826: sent out 36 bytes on interface Interface { name: "{DDABA0CE-CB81-46A3-8419-3AAB73E12297}", addr: V6(Ifv6Addr { ip: fe80::405:1e14:e86a:66e8, netmask: ::, broadcast: None }), index: Some(40) }    
2024-06-24T09:40:09.515176Z DEBUG mdns_sd::service_daemon: 2789: Broadcasting query: 1 questions 0 answers 0 authorities 0 additional    
2024-06-24T09:40:09.515886Z DEBUG mdns_sd::service_daemon: 2826: sent out 36 bytes on interface Interface { name: "{DDABA0CE-CB81-46A3-8419-3AAB73E12297}", addr: V4(Ifv4Addr { ip: 10.88.213.55, netmask: 255.255.255.255, broadcast: Some(10.88.213.55) }), index: Some(40) }    
2024-06-24T09:40:09.516164Z DEBUG mdns_sd::service_daemon: 2789: Broadcasting query: 1 questions 0 answers 0 authorities 0 additional    
2024-06-24T09:40:09.516761Z DEBUG mdns_sd::service_daemon: 2826: sent out 36 bytes on interface Interface { name: "{1342F511-09D3-458C-95F3-A8FDE793AA79}", addr: V4(Ifv4Addr { ip: 172.17.176.1, netmask: 255.255.248.0, broadcast: Some(172.17.183.255) }), index: Some(55) }    
2024-06-24T09:40:09.517266Z DEBUG mdns_sd::service_daemon: 2789: Broadcasting query: 1 questions 0 answers 0 authorities 0 additional    
2024-06-24T09:40:09.517806Z DEBUG mdns_sd::service_daemon: 2826: sent out 36 bytes on interface Interface { name: "{37217669-42DA-4657-A55B-0D995D328250}", addr: V4(Ifv4Addr { ip: 100.88.63.87, netmask: 255.255.255.255, broadcast: Some(100.88.63.87) }), index: Some(15) }    
2024-06-24T09:40:09.517959Z DEBUG mdns_sd::service_daemon: 2789: Broadcasting query: 1 questions 0 answers 0 authorities 0 additional    
2024-06-24T09:40:09.518280Z DEBUG mdns_sd::service_daemon: 2826: sent out 36 bytes on interface Interface { name: "{1342F511-09D3-458C-95F3-A8FDE793AA79}", addr: V6(Ifv6Addr { ip: fe80::65c7:9f42:a1c1:c77f, netmask: ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff, broadcast: None }), index: Some(55) }    
2024-06-24T09:40:09.518448Z DEBUG mdns_sd::service_daemon: 2789: Broadcasting query: 1 questions 0 answers 0 authorities 0 additional    
2024-06-24T09:40:09.518778Z DEBUG mdns_sd::service_daemon: 2826: sent out 36 bytes on interface Interface { name: "{37217669-42DA-4657-A55B-0D995D328250}", addr: V6(Ifv6Addr { ip: fd7a:115c:a1e0:ab12:4843:cd96:6258:3f57, netmask: ffff:ffff:ffff::, broadcast: None }), index: Some(15) }    
2024-06-24T09:40:09.519172Z DEBUG mdns_sd::service_daemon: 2789: Broadcasting query: 1 questions 0 answers 0 authorities 0 additional    
2024-06-24T09:40:09.519997Z DEBUG mdns_sd::service_daemon: 2826: sent out 36 bytes on interface Interface { name: "{20F10A59-1976-45A4-9A4A-FD4B95E34516}", addr: V4(Ifv4Addr { ip: 172.24.80.1, netmask: 255.255.248.0, broadcast: Some(172.24.87.255) }), index: Some(111) }    
2024-06-24T09:40:09.520302Z DEBUG mdns_sd::service_daemon: 2789: Broadcasting query: 1 questions 0 answers 0 authorities 0 additional    
2024-06-24T09:40:09.521011Z DEBUG mdns_sd::service_daemon: 2826: sent out 36 bytes on interface Interface { name: "{20F10A59-1976-45A4-9A4A-FD4B95E34516}", addr: V6(Ifv6Addr { ip: fe80::dcb3:6b08:e345:6963, netmask: ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff, broadcast: None }), index: Some(111) }    
2024-06-24T09:40:09.521374Z TRACE polling: 499: Poller::wait(_, Some(1s))    
2024-06-24T09:40:09.521828Z TRACE polling::iocp: 258: wait: handle=IoCompletionPort { handle: 0000000130 }, timeout=Some(1s)    
2024-06-24T09:40:09.522040Z TRACE polling::iocp: 285: new events: handle=IoCompletionPort { handle: 0000000130 }, len=4    
2024-06-24T09:40:09.522186Z DEBUG mdns_sd::service_daemon: 418: event received with key 1    
2024-06-24T09:40:09.522326Z DEBUG mdns_sd::service_daemon: 1422: received 36 bytes from IP: 192.168.1.84    
2024-06-24T09:40:09.522434Z DEBUG mdns_sd::dns_parser: 1050: read_header: id 0, 1 questions 0 answers 0 authorities 0 additionals    
2024-06-24T09:40:09.522557Z DEBUG mdns_sd::dns_parser: 1062: read_questions: 1    
2024-06-24T09:40:09.522731Z DEBUG mdns_sd::dns_parser: 1088: read_others: 0    
2024-06-24T09:40:09.522956Z DEBUG mdns_sd::service_daemon: 1811: question: DnsQuestion { entry: DnsEntry { name: "_device-name._tcp.local.", ty: 12, class: 1, cache_flush: false } }    
2024-06-24T09:40:09.523125Z TRACE polling::iocp: 201: modify: handle=IoCompletionPort { handle: 0000000130 }, sock=448, ev=Event { key: 1, readable: true, writable: false }    
2024-06-24T09:40:09.523277Z DEBUG mdns_sd::service_daemon: 418: event received with key 5    
2024-06-24T09:40:09.523453Z DEBUG mdns_sd::service_daemon: 1422: received 36 bytes from IP: 172.17.176.1    
2024-06-24T09:40:09.523705Z DEBUG mdns_sd::dns_parser: 1050: read_header: id 0, 1 questions 0 answers 0 authorities 0 additionals    
2024-06-24T09:40:09.523846Z DEBUG mdns_sd::dns_parser: 1062: read_questions: 1    
2024-06-24T09:40:09.524043Z DEBUG mdns_sd::dns_parser: 1088: read_others: 0    
2024-06-24T09:40:09.524240Z DEBUG mdns_sd::service_daemon: 1811: question: DnsQuestion { entry: DnsEntry { name: "_device-name._tcp.local.", ty: 12, class: 1, cache_flush: false } }    
2024-06-24T09:40:09.524745Z TRACE polling::iocp: 201: modify: handle=IoCompletionPort { handle: 0000000130 }, sock=456, ev=Event { key: 5, readable: true, writable: false }    
2024-06-24T09:40:09.525110Z DEBUG mdns_sd::service_daemon: 418: event received with key 6    
2024-06-24T09:40:09.525260Z DEBUG mdns_sd::service_daemon: 1422: received 36 bytes from IP: 100.88.63.87    
2024-06-24T09:40:09.525389Z DEBUG mdns_sd::dns_parser: 1050: read_header: id 0, 1 questions 0 answers 0 authorities 0 additionals    
2024-06-24T09:40:09.525476Z DEBUG mdns_sd::dns_parser: 1062: read_questions: 1    
2024-06-24T09:40:09.525620Z DEBUG mdns_sd::dns_parser: 1088: read_others: 0    
2024-06-24T09:40:09.525809Z DEBUG mdns_sd::service_daemon: 1811: question: DnsQuestion { entry: DnsEntry { name: "_device-name._tcp.local.", ty: 12, class: 1, cache_flush: false } }    
2024-06-24T09:40:09.526267Z TRACE polling::iocp: 201: modify: handle=IoCompletionPort { handle: 0000000130 }, sock=440, ev=Event { key: 6, readable: true, writable: false }    
2024-06-24T09:40:09.526519Z DEBUG mdns_sd::service_daemon: 418: event received with key 9    
2024-06-24T09:40:09.526643Z DEBUG mdns_sd::service_daemon: 1422: received 36 bytes from IP: 172.24.80.1    
2024-06-24T09:40:09.526849Z DEBUG mdns_sd::dns_parser: 1050: read_header: id 0, 1 questions 0 answers 0 authorities 0 additionals    
2024-06-24T09:40:09.527167Z DEBUG mdns_sd::dns_parser: 1062: read_questions: 1    
2024-06-24T09:40:09.527354Z DEBUG mdns_sd::dns_parser: 1088: read_others: 0    
2024-06-24T09:40:09.527609Z DEBUG mdns_sd::service_daemon: 1811: question: DnsQuestion { entry: DnsEntry { name: "_device-name._tcp.local.", ty: 12, class: 1, cache_flush: false } }    
2024-06-24T09:40:09.528092Z TRACE polling::iocp: 201: modify: handle=IoCompletionPort { handle: 0000000130 }, sock=468, ev=Event { key: 9, readable: true, writable: false }    
2024-06-24T09:40:09.528397Z TRACE polling: 499: Poller::wait(_, Some(993ms))    
2024-06-24T09:40:09.528630Z TRACE polling::iocp: 258: wait: handle=IoCompletionPort { handle: 0000000130 }, timeout=Some(993ms)    
2024-06-24T09:40:09.707253Z TRACE polling::iocp: 285: new events: handle=IoCompletionPort { handle: 0000000130 }, len=1    
2024-06-24T09:40:09.707991Z DEBUG mdns_sd::service_daemon: 418: event received with key 1    
2024-06-24T09:40:09.708612Z DEBUG mdns_sd::service_daemon: 1422: received 137 bytes from IP: 192.168.1.84    
2024-06-24T09:40:09.709338Z DEBUG mdns_sd::dns_parser: 1050: read_header: id 0, 0 questions 4 answers 0 authorities 0 additionals    
2024-06-24T09:40:09.709806Z DEBUG mdns_sd::dns_parser: 1062: read_questions: 0    
2024-06-24T09:40:09.710361Z DEBUG mdns_sd::dns_parser: 1088: read_others: 4    
2024-06-24T09:40:09.711307Z DEBUG mdns_sd::dns_parser: 1213: DnsPointer { record: DnsRecord { entry: DnsEntry { name: "_device-name._tcp.local.", ty: 12, class: 1, cache_flush: false }, ttl: 4500, created: 1719222009710, expires: 1719226509710, refresh: 1719225609710 }, alias: "specific-device-12._device-name._tcp.local." }    
2024-06-24T09:40:09.711998Z DEBUG mdns_sd::dns_parser: 1213: DnsTxt { record: DnsRecord { entry: DnsEntry { name: "specific-device-12._device-name._tcp.local.", ty: 16, class: 1, cache_flush: true }, ttl: 4500, created: 1719222009711, expires: 1719226509711, refresh: 1719225609711 }, text: [6, 83, 67, 71, 45, 67, 85] }    
2024-06-24T09:40:09.712954Z DEBUG mdns_sd::dns_parser: 1213: DnsSrv { record: DnsRecord { entry: DnsEntry { name: "specific-device-12._device-name._tcp.local.", ty: 33, class: 1, cache_flush: true }, ttl: 120, created: 1719222009712, expires: 1719222129712, refresh: 1719222105712 }, priority: 0, weight: 0, host: "specific-device-12.local.", port: 5080 }    
2024-06-24T09:40:09.713848Z DEBUG mdns_sd::dns_parser: 1213: DnsAddress { record: DnsRecord { entry: DnsEntry { name: "specific-device-12.local.", ty: 1, class: 1, cache_flush: true }, ttl: 120, created: 1719222009713, expires: 1719222129713, refresh: 1719222105713 }, address: 192.168.1.29 }    
2024-06-24T09:40:09.714446Z DEBUG mdns_sd::service_daemon: 1624: handle_response: 4 answers 0 authorities 0 additionals    
2024-06-24T09:40:09.715421Z ERROR mdns_sd::service_daemon: 1672: record: Some((DnsPointer { record: DnsRecord { entry: DnsEntry { name: "_device-name._tcp.local.", ty: 12, class: 1, cache_flush: false }, ttl: 4500, created: 1719222009710, expires: 1719226509710, refresh: 1719225609710 }, alias: "specific-device-12._device-name._tcp.local." }, true))    
2024-06-24T09:40:09.740687Z ERROR mdns_sd::service_daemon: 1672: record: Some((DnsTxt { record: DnsRecord { entry: DnsEntry { name: "specific-device-12._device-name._tcp.local.", ty: 16, class: 1, cache_flush: true }, ttl: 4500, created: 1719222009711, expires: 1719226509711, refresh: 1719225609711 }, text: [6, 83, 67, 71, 45, 67, 85] }, true))    
2024-06-24T09:40:09.781434Z ERROR mdns_sd::service_daemon: 1672: record: Some((DnsSrv { record: DnsRecord { entry: DnsEntry { name: "specific-device-12._device-name._tcp.local.", ty: 33, class: 1, cache_flush: true }, ttl: 120, created: 1719222009712, expires: 1719222129712, refresh: 1719222105712 }, priority: 0, weight: 0, host: "specific-device-12.local.", port: 5080 }, true))    
2024-06-24T09:40:09.809404Z ERROR mdns_sd::service_daemon: 1672: record: Some((DnsAddress { record: DnsRecord { entry: DnsEntry { name: "specific-device-12.local.", ty: 1, class: 1, cache_flush: true }, ttl: 120, created: 1719222009713, expires: 1719222129713, refresh: 1719222105713 }, address: 192.168.1.29 }, true))    
2024-06-24T09:40:09.840974Z TRACE polling::iocp: 201: modify: handle=IoCompletionPort { handle: 0000000130 }, sock=448, ev=Event { key: 1, readable: true, writable: false }    
2024-06-24T09:40:09.841701Z TRACE polling: 499: Poller::wait(_, Some(680ms))    
2024-06-24T09:40:09.842369Z TRACE polling::iocp: 258: wait: handle=IoCompletionPort { handle: 0000000130 }, timeout=Some(680ms)    
2024-06-24T09:40:10.524323Z TRACE polling::iocp: 285: new events: handle=IoCompletionPort { handle: 0000000130 }, len=0    
2024-06-24T09:40:10.524867Z TRACE polling::iocp: 314: wait: no events found, re-entering polling loop    
2024-06-24T09:40:10.525471Z TRACE polling::iocp: 285: new events: handle=IoCompletionPort { handle: 0000000130 }, len=0    
2024-06-24T09:40:10.527162Z DEBUG mdns_sd::service_daemon: 1378: Sending multicast queries: [("_device-name._tcp.local", 12)]

The line you were looking for is now also included. I did change the service name and the device name hopefully this is not a problem.

I am wondering if I can somehow receive the replies/information the service does receive.

keepsimple1 commented 3 months ago

2024-06-24T09:40:09.508279Z DEBUG mdns_sd::service_daemon: 1378: Sending multicast queries: [("_device-name._tcp.local", 12)]

Looks like the service type name is missing . at the end. (Should be like _device-name._tcp.local.) Can you check if add an ending . would fix the problem?

(If that helps, maybe we should add a sanity check for this)

GunnarMorrigan commented 3 months ago

@keepsimple1 you are right with the . it works.

I would like to thank you for the nice library :)