Node-red does not work -bind address

I run CoAP server (txthing) in raspberry pi, this server works on 0.0.0.0:5683
and I run node-red in the same device. when I run both at the same time, .. node-red doesnt work and there is error in the log
"Error:bind EADDRINUSE 0.0.0.0:5683"
at object._errorExeption (util.js:1022:11)

when I close CoAP server, node-red returns back to work

maybe I an not too strong in networks, but I don't know why this error if each one works in different port...
could you help me, please?

Thanks

Can you post the full log you get when you start node-red with CoAP running? You can run

node-red-stop
node-red-start

to see it.

[Edit] Also what node are you using to communicate with CoAP?

I don't use any node to connect CoAP server, but I run it to connect with client in another device. I did this as there is no node for CoAP response (server) in node red. so, I just run CoAP server in the same device with node-red

OK, we need to see the log then to see why node red is listening on the CoAP port.

this surprised me, I can't understand why?
I will post the log when I go back to my office in the university at the beginning of week. thanks for your concern.

Have you installed node-red-contrib-coap? I am not sure what it does but I suspect it might listen on that port.

Am I missing something

Are you trying to run node red on the same port as this "CoAP server"

I'm not certain what that is or if it opens a port on 5683 but if it does and you're trying to run node-red on the same port (or any other application that requires a TCP port) it will fail.

As a test, run node red on the default port 1880. See if you can connect to it in your browser http://ipaddress:1880 & tell us how that goes.

Thank guys,
I know that node-red listen by default to 1880, and I don't want to change it. further, I have not changed any thing in settings.js.

At the beginning, I installed node-red-contrib-coap to try it then I deleted it.
after that, I installed CoAP server (txthing) and I worked with it, when I run node-red at the same time .. it shows error in the log like this ...
[info] Starting flows
29 Jan 09:24:25 - [info] Started flows
29 Jan 09:24:25 - [red] Uncaught Exception:
29 Jan 09:24:25 - Error: bind EADDRINUSE 0.0.0.0:5683

at Object._errnoException (util.js:1022:11)
nodered.service: Main process exited, code=exited, status=1/FAILURE
nodered.service: Unit entered failed state.
nodered.service: Failed with result 'exit-code'.
nodered.service: Service hold-off time over, scheduling restart.
Stopped Node-RED graphical event wiring tool.
Started Node-RED graphical event wiring tool.
29 Jan 09:24:30 - [info]
Welcome to Node-RED

when I executed this command ...

netstat -punta |grep 5683

udp 0 0 0.0.0.0:5683 0.0.0.0:* 1037/node-red
and I did it again after reboot
udp 0 0 0.0.0.0:5683 0.0.0.0:* 1186/node-red

could you help me to know what is the problem?

that would indicate that the coap node (probably) was not uninstalled and is still present and running in Node-RED (and grabbing the port). Try looking in your ~/.node-red/node_modules directory and see if it's there still.

I have this in the directory
better -assert .................... node-red-contrib-coap
coap .................. ... nofilter
coap-packet .................. oauth-sign

so yes - you didn't manage to uninstall it.
You should be able to run

npm uninstall node-red-contrib-coap

from the `~/.node-red/ directory to remove it. thne stop and restart Node-RED.
Worst case you can just delete the three coap related directories manually.

I did it, however when I restart it.... it shows waiting coap-server ..
and I cant deploy it, it shows
flow stopped due to missing node-types
coap-server

I checked all my flows, I dont have any coap node....
and what is coap-server?!

I have just known the error, I deleted all unused nodes in the configure node, and after that everything works . NR and coap server work at the same time...
and I think this is the reason for all my problems with proxy as well, I will check it again...

thanks a lot for you..
you make my day :slight_smile:

1 Like

In an earlier post you said:

So you are using a separate CoAP server as there is no node-red node that supports this. The problems you have found seem to suggest that the CoAP node does indeed provide a CoAP server.

Actually, If I got your talk correctly, my answer would be:
I surprised when NR log showed there is coap server error. As I tried use coap node in NR.. it send only request not response. So that means it is not server,
As I worked with separate coap, the client sent request( e.g, get) and server respond and send ACk as well in case of conf message.
I have not found any node for coap server in node-red, although I installed all the available nodes and tried it.

According to the readme for Coap In node included in that package it should operate as a server.
Did you see the examples installed with the node? Particularly https://github.com/reederz/node-red-contrib-coap/blob/master/examples/server_flow.json
However, I have not used it, just looked at the readme.