Comments (6)
Encountering the same error. I have no idea if it's related but I recently updated Windows. Here is my version:
Edition Windows 10 Pro
Version 20H2
Installed on 2/27/2021
OS build 19042.1052
Experience Windows Feature Experience Pack 120.2212.2020.0
I keep getting
Error: bind EACCES 0.0.0.0:56700
each time I try to discover.
Also my Wifi went out and came back yesterday so I think that could be the problem.
from node-lifx-lan.
I'm also seeing this problem (on the same build of Windows, if that's related).
Error: bind EADDRINUSE 0.0.0.0:56700
at dgram.js:357:20
at processTicksAndRejections (internal/process/task_queues.js:83:21) {
errno: -4091,
code: 'EADDRINUSE',
syscall: 'bind',
address: '0.0.0.0',
port: 56700
}
Using netstat -a -p UDP
I can confirm the port is closed correctly when I terminate my application. When I run it again, I get the above error when the discover()
call is made. If comment out that call, I do not get the error.
Edit: I ran into this again today, and this time it was happening 100%. Again, netstat reported no applications on UDP 56700. I had a look at the library source, and it appears to be doing nothing more than dgram createSocket & bind. I tried using the "reuseAddr" option on createSocket, but it made no difference. I then closed everything down and ran a node app that did nothing other than create/bind the socket, and it failed just the same. I was able to bind other ports without any problems. I then rebooted my machine and upon restart I was able to bind 56700 without problem. I suspect this has nothing to do with the node-lifx-lan library, and more likely just windows handling closing ports badly.
from node-lifx-lan.
Looking at the code, the resolution is simple. The problem is that .init()
initializes an UDP socket if not initialized yet, but this process takes a few milliseconds out of event loop, so if you call createDevice
more than once in a row it will throw.
You need to start using module like:
const Lifx = require("node-lifx-lan");
Lifx.init().then(() => {
// now you can discover, create devices, etc..
})
from node-lifx-lan.
Thanks @dresende, but OP is already calling discover().then (which internally calls init().then) and I'm calling await Lifx.init() before using the library at all. I'm pretty sure this is unrelated to the Lifx library, but rather Windows socket handling.
from node-lifx-lan.
Thanks @dresende, but OP is already calling discover().then (which internally calls init().then)
But if I call .createDevice twice in the same event, init() will not finish and be called twice, trying to bind the UDP socket twice.
I'm pretty sure this is unrelated to the Lifx library, but rather Windows socket handling.
You're wrong. I'm on macOS and had the same problem, that's why I came here. And I solved it by doing just that.
from node-lifx-lan.
If you don't wait for init() to complete before calling createDevice multiple times, then you will absolutely run into this error. However, I always wait for init() to complete before calling any other library function, and I'm saying that the issue I was seeing appeared to be Windows specific.
from node-lifx-lan.
Related Issues (20)
- Takes forever to load lights list HOT 4
- multiZoneSetColorZones() does not support CSS (as per LifxLanColor) HOT 9
- Question - how to create morph effect HOT 1
- CreateDevice
- Tile support
- Support for firmware effects? HOT 1
- Custom Wave Animation HOT 1
- Timeout on createDevice: no wait parameter HOT 1
- Activating scenes HOT 4
- How to define res_required HOT 2
- Missing dgram dependency HOT 2
- discover stops working if first calling on different network than the one with lifx devices on it HOT 4
- createDevice
- Toggle Power Function
- WSL
- Duration Cannot Be >65,535
- Repeat Discover Error - "Error: send EACCES " HOT 1
- it won't install ENOSELF error
- Broadcast addrerss is not being set correctly for /26 netmask
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-lifx-lan.