I've written a web-server using Node.js. When I tried to test my server with the tester I've written for it, I succeed only if the port I'm using for the server is not 80. I've checked on netstat, and no other application is using port 80. The error I'm getting on the console is:
Error: connect ECONNREFUSED
at errnoException (net.js:640:11)
at Object.afterConnect [as oncomplete] (net.js:631:18)
What can be done in this case?
You might not have permission to bind to ports below 1024 (including 80) as a normal user (e.g. non-root), try a higher numbered port (above 1024, e.g. 8080).
[Edit]
Depending on your target system, and assuming you are its administrator, then you can probably work around the problem like so:
Execute your program using "sudo", such as:
sudo node ./myprogram.js
.Or, login as the "root" user on your system and run the program as normal.
However, don't get in the habit of doing either of these on a regular basis (until you understand why), they can potentially introduce security holes which may be exploitable by malicious, motivated individuals.