athombv / homey-apps-sdk-issues

This issue tracker is for Homey Developers using the Apps SDK.
21 stars 4 forks source link

EADDRNOTAVAIL error #338

Closed ralf3420 closed 8 months ago

ralf3420 commented 8 months ago

I get an error 'EADDRNOTAVAIL' when I try to listen to a port on homey. I tried all addresses of homey (ip4,ip6), but ended up always with the same result.

error message:------------------------------------------------------------------------------------------------------------------------------ Error: listen EADDRNOTAVAIL: address not available 10.0.0.111:1025 at Server.setupListenHandle [as _listen2] (node:net:1446:21) at listenInCluster (node:net:1511:12) at doListen (node:net:1660:7) at processTicksAndRejections (node:internal/process/task_queues:84:21) Emitted 'error' event on Server instance at: at emitErrorNT (node:net:1490:8) at processTicksAndRejections (node:internal/process/task_queues:83:21) { code: 'EADDRNOTAVAIL', errno: -99, syscall: 'listen', address: '10.0.0.111', port: 1025} coding: --------------------------------------------------------------------------------------------------------------------------------------- const Homey = require('homey'); const net = require('node:net');

// installation of a TCP/IP Server const server = net.createServer();

class MyApp extends Homey.App { async onInit() { // homey starts it, when app initialized this.log('App has been initialized'); // server.on('connection',(sock) => { ...... });

 **server.listen(1025, '10.0.0.111', () => {              //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<**
      console.log('server bound',server.address());
  });// server ---- listen -------------------------------

} // ----------On Init Homey.app } module.exports = MyApp;


... "platforms": [ "local" ], "category": [ "tools" ], "permissions": [], ...

I didn't defined an app key. If that is the reason, how and where can I define one? I reduced the coding as much as possible. It is for sure not the entire app, but this one produces the error, I am struggling with!

Thank you for any support! Ralf