You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error: getsockname EBADF
at Socket.address (node:dgram:775:11)
at CoapServer.getPort (/node_modules/@node-wot/binding-coap/dist/coap-server.js:104:27)
at CoapServer.<anonymous> (/node_modules/@node-wot/binding-coap/dist/coap-server.js:112:31)
at Generator.next (<anonymous>)
at /node_modules/@node-wot/binding-coap/dist/coap-server.js:31:71
at new Promise (<anonymous>)
at __awaiter (/node_modules/@node-wot/binding-coap/dist/coap-server.js:27:12)
at CoapServer.expose (/node_modules/@node-wot/binding-coap/dist/coap-server.js:111:16)
at /node_modules/@node-wot/core/dist/servient.js:51:40
at Array.forEach (<anonymous>) {
errno: -9,
code: 'EBADF',
syscall: 'getsockname'
}
The error does not happen if I expose only 1 CoAP device and only happens with CoAP. (I run the same code to generate HTTP instances as well and it works flawlessly). I was able to replicate the error in a Windows environment and in a dockerized Ubuntu environment running an Ubuntu host.
The text was updated successfully, but these errors were encountered:
A small update: I found what was causing this issue. I was calling servient.start() for each new device added to get the WoT object which did break things severely for CoAP and not so severely for HTTP. By calling servient.start() only once, the issues were solved and I could add multiple CoAP devices without any issues.
The problem is, there is nothing stopping me from calling servient.start() multiple times. How about ensuring that calling servient.start() always returns exactly one WoT object using a singleton pattern? Otherwise, I think it is safe to close this issue.
When I try to add multiple CoAP devices to the same servient defined like this
it causes this error to occur
The error does not happen if I expose only 1 CoAP device and only happens with CoAP. (I run the same code to generate HTTP instances as well and it works flawlessly). I was able to replicate the error in a Windows environment and in a dockerized Ubuntu environment running an Ubuntu host.
The text was updated successfully, but these errors were encountered: