concept TCP server in category javascript

appears as: TCP servers, The TCP server, TCP server
Node.js in Practice

This is an excerpt from Manning's book Node.js in Practice.

Node is a platform for developing network applications. It’s built on V8, Google’s JavaScript runtime engine. Node isn’t just V8, though. An important part of the Node platform is its core library. This encompasses everything from TCP servers to asynchronous and synchronous file management. This book will teach you how to use these modules properly.

This is a long example, but it centers around a relatively simple method: net.connect. This method accepts some optional arguments to describe the remote host. Here we’ve just specified a port number, but the second argument can be a hostname or IP address—localhost is the default . It also accepts a callback, which can be used to write data to the other end once the client has connected. Remember that TCP servers are full-duplex, so both ends can receive and send data.