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

Close DHCP server correct after bound #36

Open
wake-0 opened this issue Aug 23, 2018 · 3 comments
Open

Close DHCP server correct after bound #36

wake-0 opened this issue Aug 23, 2018 · 3 comments

Comments

@wake-0
Copy link

wake-0 commented Aug 23, 2018

Hello all!

How should the server correctly be closed after an IP address was bound?
I actually added it to the on bound but not sure if this is the correct place, because the following error appears "Error: Not running." Without the server.close() in the on bound no error appears but I am also not able to close the server :D

Example code:

server.on('bound', function(state) {
    console.log("bound ip address.");
    server.close();   
});

This shows the "Error: Not running".

process.on('uncaughtException', (err) => {
    console.log(err.stack);
});
@infusion
Copy link
Owner

Why would you close the server after the IP was bound? DHCP is based on UDP, which is stateless, there is no open connection. Closing the server means no incoming connections are handled anymore. Or is this your desired behavior, that you handle only one single client and as soon as the user got an IP, you terminate the server? Then closing the server on bound should be ok.

@wake-0
Copy link
Author

wake-0 commented Aug 27, 2018

Yeah exactly. I created a test, where I assign a single ip address via dhcp and afterwards the server can be stopped. --> If the DHCP server is closed like described above I will get a "Error: not running". Can this behaviour be fixed?

@isarantis
Copy link

Any news about that? i would like to make something similar to start/stop the service when i want.

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

3 participants