Valentin Barral Valentin Barral - 3 months ago 19
Node.js Question

What is the difference between net.connect and net.createConnection in node.js?

I was reading the documentation from the net module in Node.js and I can't see any difference between the methods

net.connect
and
net.createConnection
.

Are they exactly the same or is there is some difference?

Answer

There's no difference. Here's an extract from the source code:

exports.connect = exports.createConnection = function() {

I agree the documentation isn't clear on that point.