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

Service not found on android when name is ip address #6

Closed
kevin-dp opened this issue Mar 15, 2016 · 10 comments
Closed

Service not found on android when name is ip address #6

kevin-dp opened this issue Mar 15, 2016 · 10 comments
Labels

Comments

@kevin-dp
Copy link

Hi,

I'm using the plugin for one of my projects, until now I tested it on iOS and it works fine.
However, on Android (Nexus 5 phone) the published services are not found.

Because I don't want my app to publish accidentally a service with the same name as another one I'm using the machine's ip address as name, hence it will be unique. But Android refuses to publish them.

I made a minimal example that shows the problem :

var zeroconf = cordova.plugins.zeroconf;
zeroconf.watch('_http._tcp.local.', function(result) { 
    // Display result.service.name --> Displayed on iOS but not on Android
});

// If below i provide as name '192/168/0/205' it also works on Android, but with the points not...
zeroconf.register('_http._tcp.local.', '192.168.0.205', 80, {
        'foo' : 'bar'
});
@becvert
Copy link
Owner

becvert commented Mar 15, 2016

I'll have a look

@becvert
Copy link
Owner

becvert commented Mar 16, 2016

can you try "192.168.0.205._http._tcp.local"?

else report the issue with the jmdns library.

I'm trying get a more recent version of that library.

as a workaround, you could also publish a more user-friendly name such as a host name or device name cordova-plugin-device-name

@kevin-dp
Copy link
Author

I tried with "192.168.0.205._http._tcp.local" but that's not working either.
I could indeed use a more user-friendly hostname, although I don't understand why using that name does not work as it simply is a string like every other name.

Thanks for your time.

@becvert
Copy link
Owner

becvert commented Mar 18, 2016

I agree with you. I don't understand why it is not working.
I believe it is an issue with the jmdns library.

@kevin-dp
Copy link
Author

Note that a few years ago a master student at our university did some research about the topic. He found out that Android's official NSD support seemed to be more stable than jmdns, and he used it in his app, with success. It could be nice to test this one :)

Thanks for your plugin and the support you provide.
You did an awesome job!

@becvert
Copy link
Owner

becvert commented Mar 18, 2016

But API 16 is required for NSD.
I think I'll try it anyway.
And provide both implementations (JmDNS and NSD).

Also note that I think both JmDNS and NSD prevent collisions by incrementing service names.
eg "NsdChat" to "NsdChat (1)"

@kevin-dp
Copy link
Author

Indeed.

I would be very interested for the NSD implementation.
Keep me in touch :)

@becvert
Copy link
Owner

becvert commented Mar 19, 2016

I won't (or can't) fix your issue
But an NSD implementation (#7)
or a more recent version of JmDNS might fix this problem.
Closing now. Thanks.

@becvert
Copy link
Owner

becvert commented Mar 19, 2016

JmDNS seems to have fixed the issue https://github.com/jmdns/jmdns/blob/master/CHANGELOG.txt

problem with . in name

@becvert
Copy link
Owner

becvert commented Mar 31, 2016

I upgraded JmDNS.
I think it fixes the issue.

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

No branches or pull requests

2 participants