Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Registered services aren't showing up when using standard tools to test #13

Closed
dljsjr opened this issue Feb 4, 2022 · 11 comments
Closed

Comments

@dljsjr
Copy link

dljsjr commented Feb 4, 2022

I'm trying to implement a very minimal service advertisement for use in some unit tests for a strictly client implementation in a different project. I'm more or less pattern matching directly off the code in the documentation; this is the current test main I'm using to eval the library:

fn main() {
    let dummy_service_daemon =
        mdns_sd::ServiceDaemon::new().expect("Could not create service daemon");

    let test_service_type = "_mytest._udp._local";
    let instance_name = "test_instance";
    let service_host_ipv4 = "192.168.1.176";
    let service_hostname = "192.168.1.176.local.";
    let port = 5200;

    let service_info = mdns_sd::ServiceInfo::new(
        test_service_type,
        instance_name,
        service_hostname,
        service_host_ipv4,
        port,
        None,
    );

    println!("Addresses: {:?}", &service_info.get_addresses());

    dummy_service_daemon
        .register(service_info)
        .expect("Failed to register test service");

    loop {
        std::thread::sleep(std::time::Duration::from_millis(100))
    }
}

The service does not seem to be advertised anywhere though. I've tested on both macOS using dns-sd and Ubuntu 20.04 using mdns-scan and the service does not show up. Some example commands I've tried:

$> dns-sd -B _services._udp. local. (this should show all dns-sd services)
$> dns-sd -B _mytest_.udp local. (a direct query against the service type, still shows nothing)

I'm not sure if this is a bug or if there is something missing from the docs that I haven't done correctly here. Thanks for any help you can provide with this!

@keepsimple1
Copy link
Owner

let test_service_type = "_mytest._udp._local";

The type should end with ".local." . Could you please try that? Then you can try

dns-sd -B _mytest_.udp. or dns-sd -B _mytest_.udp. local.

I've not used -B _services._udp. local., will check that out.

@dljsjr
Copy link
Author

dljsjr commented Feb 4, 2022

🤦 it was the _ before local, which I knew shouldn't be there and I just made a copy paste bug. That said, the server still only responds to direct queries and not the "browse all" query.

@dljsjr
Copy link
Author

dljsjr commented Feb 4, 2022

Also it's _services._dns-sd._udp.local., I haven't had enough coffee yet (still doesn't work though)

@keepsimple1
Copy link
Owner

keepsimple1 commented Feb 4, 2022

I tried the following works:

$ dns-sd -B _services._dns-sd._udp.

or

$ dns-sd -B _services._dns-sd._udp. local.

i.e. no local. or give a space before local.

@dljsjr
Copy link
Author

dljsjr commented Feb 4, 2022

That's how I'm testing and it's not working 🤔

@keepsimple1
Copy link
Owner

Looks like I saw it working only because it's in local machine and in dns buffer. Currently our code does not really support wildcard query as I didn't know about it before. It's a missing feature we need to support.

Meantime, is it okay for you to use the direct name query? or is the wildcard support a blocker?

@dljsjr
Copy link
Author

dljsjr commented Feb 4, 2022

The direct name query is fine for my unit tests, thanks!

@keepsimple1
Copy link
Owner

PR is submitted to fix this issue. My local test seems to be good. If you can help testing the PR branch wildcard, that will be great! Thanks.

@keepsimple1
Copy link
Owner

PR merged. You can try it using the latest from this git repo main branch.

@keepsimple1
Copy link
Owner

New crate version v0.4.2 released. Please help check that fixes the issue for you. Thanks!

@dljsjr
Copy link
Author

dljsjr commented Feb 8, 2022

Looking good to me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants