Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Node.JS: Reusing sockets?

Tags:

node.js

I tries to execute this script:

require('net').createServer().listen('/tmp/test');

First time script runs successfully, but on the second start node.js throwing error: Error: listen EADDRINUSE

Is there any way to reuse sockets (unix and tcp too)?

like image 879
Sirian Avatar asked Jun 03 '26 07:06

Sirian


1 Answers

Apparently your script/listener/server from the first call is still running. You have to kill the script/process that is listening in order to use the same port again.

like image 143
Marc Diethelm Avatar answered Jun 05 '26 20:06

Marc Diethelm



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!