# Class: NetServer

## vertx-js/net_server~ NetServer

#### new NetServer()

  Represents a TCP server
  Source:
    - net_server.js, line 32

### Methods

#### actualPort() → {number}

  The actual port the server is listening on. This is useful if you bound the server specifying 0 as port number signifying an ephemeral port
  Source:
    - net_server.js, line 165

  ##### Returns:

  the actual port the server is listening on.
  Type
    number

#### close(completionHandler)

  Like NetServer#close but supplying a handler that will be notified when close is complete.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `completionHandler` | function | the handler

  Source:
    - net_server.js, line 142

#### connectHandler(handler) → {NetServer}

  Supply a connect handler for this server. The server can only have at most one connect handler at any one time. As the server accepts TCP or SSL connections it creates an instance of NetSocket and passes it to the connect handler.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `handler` | function |

  Source:
    - net_server.js, line 77

  ##### Returns:

  a reference to this, so the API can be used fluently
  Type
    NetServer

#### connectStream() → {NetSocketStream}

  Return the connect stream for this server. The server can only have at most one handler at any one time. As the server accepts TCP or SSL connections it creates an instance of NetSocket and passes it to the connect stream .
  Source:
    - net_server.js, line 61

  ##### Returns:

  the connect stream
  Type
    NetSocketStream

#### isMetricsEnabled() → {boolean}

  Whether the metrics are enabled for this measured object
  Source:
    - net_server.js, line 45

  ##### Returns:

  true if the metrics are enabled
  Type
    boolean

#### listen(port, host, listenHandler) → {NetServer}

  Like NetServer#listen but providing a handler that will be notified when the server is listening, or fails.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `port` | number | the port to listen on
  `host` | string | the host to listen on
  `listenHandler` | function | handler that will be notified when listening or failed

  Source:
    - net_server.js, line 95

  ##### Returns:

  a reference to this, so the API can be used fluently
  Type
    NetServer