ECONNRESET Errors in node.js and Express on the same port

The Problem

Running a basic node.js + express + setup, I would occasionally get ECONNRESET errors. After a bit of trial and error, I found that this seems to have been caused by running and express on the same port, port 80.


I opened up port 81 on the server, and ran through port 81. My code to set things up now looks like:

var httpPort = 80;
var socketIOPort = 81;

var express = require('express');
var app = express();
var socketIO = require('');
var io = socketIO.listen(socketIOPort);

I then had to update the client-side Javascript to connect on port 81, and so far I've never had these errors since. For reference I'm running node.js v0.10.0, Express v3.3.4 and v0.9.16.