O'Reilly logo

Node.js, MongoDB, and AngularJS Web Development by Brad Dayley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The net.Socket Object

Socket objects are created on both the socket server and the socket client and allow data to be written and read back and forth between them. The Socket object implements the Duplex stream, so it provides all the functionality that Writable and Readable streams provide. For example, you can use the write() method to stream writes of data to the server or client and a data event handler to stream data from the server or client.

On the socket client, the Socket object is created internally when you call net.connect() or net.createConnection(). This object is intended to represent the socket connection to the server. You use the Socket object to monitor the connection, send data to the server, and handle the response from the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required