I am trying to run a NodeJS application(udp_recv) using pm2. The application starts on boot via pm2 startup and pm2 save. However, the dgram gives me an error saying -
server error:
1|udp_recv | Error: bind EADDRNOTAVAIL 192.168.0.9:7001
1|udp_recv | at state.handle.lookup (dgram.js:242:18)
1|udp_recv | at process._tickCallback (internal/process/next_tick.js:63:19)
1|udp_recv | at Function.Module.runMain (internal/modules/cjs/loader.js:834:11)
1|udp_recv | at startup (internal/bootstrap/node.js:283:19)
1|udp_recv | at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
But once I stop all the application (pm2 stop all) and re-run (pm2 start all) Then there's no error and the application runs normally without any error.
My IP is 192.168.0.9 listening for UDP streams on a predefined port. The computer connected via ethernet sends the UDP streams from IP 192.168.0.6
Can someone tell me how to solve the error?