Listening for Socket Connections
Networked services exist to do two things: connect endpoints and transmit information between them. No matter what kind of information is transmitted, a connection must first be made.
In this section, youâll learn how to create socket-based services using Node.js. Weâll develop an example application that sends data to connected clients, then weâll connect to this service using standard command-line tools. By the end, youâll have a good idea of how Node.js does the client/server pattern.
Binding a Server to a TCP Port
TCP socket connections consist of two endpoints. One endpoint binds to a numbered port while the other endpoint connects to a port.
This is a lot like a telephone system. One phone binds ...