Skip to content

Files

Latest commit

Aug 30, 2017
365b8db · Aug 30, 2017

History

History
18 lines (14 loc) · 735 Bytes

class_net_socket.md

File metadata and controls

18 lines (14 loc) · 735 Bytes

This class is an abstraction of a TCP socket or a streaming [IPC][] endpoint (uses named pipes on Windows, and UNIX domain sockets otherwise). A net.Socket is also a [duplex stream][], so it can be both readable and writable, and it is also a [EventEmitter][].

A net.Socket can be created by the user and used directly to interact with a server. For example, it is returned by [net.createConnection()][], so the user can use it to talk to the server.

It can also be created by Node.js and passed to the user when a connection is received. For example, it is passed to the listeners of a ['connection'][] event emitted on a [net.Server][], so the user can use it to interact with the client.