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

Discovery will not work for devices with multiple network interfaces #55

Closed
JefStat opened this issue Aug 15, 2016 · 10 comments
Closed
Milestone

Comments

@JefStat
Copy link

JefStat commented Aug 15, 2016

A common setup is to attach cameras to a second network interface which is not the interface for the default gateway of the host.

This line will only broadcast to the interface which is the default gateway: , socket = require('dgram').createSocket('udp4');
https://github.com/agsh/onvif/blob/master/lib/discovery.js#L89

@chriswiggins
Copy link
Collaborator

Want to submit a pull request to fix that? Is there a way we can do the broadcast on all interfaces?

On 16/08/2016, at 8:54 AM, Jef Statham <notifications@github.commailto:notifications@github.com> wrote:

A common setup is to attach cameras to a second network interface which is not the interface for the default gateway of the host.

This line will only broadcast to the interface which is the default gateway: , socket = require('dgram').createSocket('udp4');
https://github.com/agsh/onvif/blob/master/lib/discovery.js#L89

You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHubhttps://github.com//issues/55, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ACsxEWkeYNxYOl1pO1gphEZGawBmh1Nyks5qgNIVgaJpZM4JkwvC.

@agsh
Copy link
Owner

agsh commented Aug 16, 2016

I suppose that this is about addMembership method. @JefStat, am I right?

@JefStat
Copy link
Author

JefStat commented Aug 16, 2016

@chriswiggins I plan to work on it in the near term I created the issue partially for myself ;)

@agsh

I suppose that this is about addMembership method. @JefStat, am I right?

addMembership is not the issue. addMembership is for listening to the multicast queries and responses not emitting them.

Here's a snippet of what I have working for some PSIA cameras

var os          = require('os');
self.networkInterfaces = os.networkInterfaces();
self.networkAddresses = _.flatten(_.map(self.networkInterfaces, function (o) {
    return o;
}));

self.externalNetworkAddresses = _.filter(self.networkAddresses, function (o) {
    return !o.internal && o.family === 'IPv4';
});

var multicastSetup = function () {
    return _.map(self.externalNetworkAddresses, function (o) {
        return new Promise(function (resolve, reject) {
            var timeout = setTimeout(reject, 30 * 1000, 'socket binding timeout');
            var socket  = dgram.createSocket('udp4');

            socket.bind(self.port, o.address, function () {
                clearTimeout(timeout);
                socket.setBroadcast(true); // can only call after bind
                resolve(socket);
           });
        });
    });
};

@agsh agsh added this to the 0.6 milestone Aug 19, 2016
@Climax777
Copy link
Contributor

has this been implemented yet?

@Climax777
Copy link
Contributor

Climax777 commented Oct 6, 2016

I'm thinking of forking and allowing an option to specify an interface. This way the user has some control over which interface he/she wants to broadcast and listen on. Would this suffice for this issue? This would definitely be sufficient for my needs. Special case of this is the user can probe independently on each interface as he/she wishes.

@JefStat
Copy link
Author

JefStat commented Oct 6, 2016

That would work for my issue. I'm still a ways off from using onvif problems with manufacture non onvif sdk required before onvif endpoints are available.

@Climax777
Copy link
Contributor

Great I'm almost done, just need some testing.

On Thu, Oct 6, 2016 at 6:56 PM Jef Statham notifications@github.com wrote:

That would work for my issue. I'm still a ways off from using onvif
problems with manufacture non onvif sdk required before onvif endpoints are
available.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#55 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAu7nQ2i3HKL2WuevfTo9yVS5DdekBNmks5qxSglgaJpZM4JkwvC
.

@Climax777
Copy link
Contributor

@agsh and others please check my pull request and comment on any changes you may want

@agsh agsh closed this as completed in 74cf9e0 Oct 6, 2016
agsh added a commit that referenced this issue Oct 6, 2016
Fixed #55: Discovery with multiple network interfaces
@agsh
Copy link
Owner

agsh commented Oct 6, 2016

@Climax777 done. Thanks for tests! NPM published.

@Climax777
Copy link
Contributor

Excellent!

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

4 participants