i

Net module

The net module provides us asynchronous network API for creating stream-based TCP servers and clients.

Lets have a look at an example

Server.js

Client.js

Output :

In Server.js terminal

Open another terminal and run client.js alongside:

As server sees a client connected, going back to terminal 1, we find “Client connected logged”: