Node.js – Networks

Listening for Socket connections

To bind a TCP port to listen for connections is relatively simple:

"use strict";
const
  net = require('net'),
  server = net.createServer(function(connection) {
    //do something with the connection
  });
server.listen(3000);