Namespace node.net

The net module provides you with an asynchronous network wrapper. It contains methods for creating both servers and clients (called streams). You can include this module with require("net");

Method Summary

Method Attributes Method Name and Description
static  
node.net.createConnection(port, host)
Construct a new socket object and opens a socket to the given location.
static  
node.net.createServer()
Creates a new TCP server.
static  
node.net.isIP()
#### net.isIP(input) Tests if input is an IP address.
static  
node.net.isIPv4(input)
static  
node.net.isIPv6(input)

Method Detail

  • static node.net.createConnection(port, host)
    Construct a new socket object and opens a socket to the given location. When the socket is established the 'connect' event will be emitted. The arguments for this method change the type of connection: * net.createConnection(port, [host]) Creates a TCP connection to port on host. If host is omitted, localhost will be assumed. * net.createConnection(path) Creates unix socket connection to path ---
    Parameters:
    {string} port
    {string} host
  • static node.net.createServer()
    Creates a new TCP server. The connectionListener argument is automatically set as a listener for the 'connection' event.
  • static node.net.isIP()
    #### net.isIP(input) Tests if input is an IP address. Returns 0 for invalid strings, returns 4 for IP version 4 addresses, and returns 6 for IP version 6 addresses. #### net.isIPv4(input) Returns true if input is a version 4 IP address, otherwise returns false. #### net.isIPv6(input) Returns true if input is a version 6 IP address, otherwise returns false.
  • static node.net.isIPv4(input)
    Parameters:
    {string} input
  • static node.net.isIPv6(input)
    Parameters:
    {string} input