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

Detect when local IP change #23

Open
fpasxos opened this issue Apr 4, 2018 · 1 comment
Open

Detect when local IP change #23

fpasxos opened this issue Apr 4, 2018 · 1 comment

Comments

@fpasxos
Copy link

fpasxos commented Apr 4, 2018

Hello everyone,

Is there any way to detect that the local IP Address has changed?
Let's suppose that machine's IP is 192.168.150.5 and somehow the machine receives another IP and now has 192.168.150.6 from DHCP. Is there any listener which 'listens' that kind of changes?

-I have set up ONLY a dhcp client (from DHCP module) -and not a dhcp server from the module - and I receive IPs from default DCHP(router's).

Is there any way to achieve that??

Thanks in advance

@mStirner
Copy link

mStirner commented Mar 28, 2019

You can sniff the DHCP messages and compare the assigned ip address

var dhcp = require('../lib/dhcp.js');

var s = dhcp.createBroadcastHandler();

s.on('message', function (data) {
// compare ip address for mac...
});

s.listen();

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