Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.vertx.groovy.core.net
[Groovy] Class NetServer

    java.lang.Object
      org.vertx.groovy.core.net.NetServer

    abstract class NetServer

Represents a TCP or SSL server

This class is a thread safe and can safely be used by different threads.

If an instance is instantiated from an event loop then the handlers of the instance will always be called on that same event loop. If an instance is instantiated from some other arbitrary Java thread then and event loop will be assigned to the instance and used when any of its handlers are called.

Instances cannot be used from worker verticles

Authors:
  Peter Ledbrook
  Tim Fox

Field Summary
`protected NetServer` | `jServer`

Method Summary
`void` | `close()` Close the server.
`void` | `close(groovy.lang.Closure hndlr)` Close the server.
`NetServer` | `connectHandler(groovy.lang.Closure hndlr)` Supply a connect handler for this server.
`java.lang.Integer` | `getAcceptBacklog()` @return The accept backlog
`java.lang.String` | `getKeyStorePassword()` @return The keystore password
`java.lang.String` | `getKeyStorePath()` @return The path to the key store
`java.lang.Integer` | `getReceiveBufferSize()` @return The TCP receive buffer size
`java.lang.Integer` | `getSendBufferSize()` @return The TCP send buffer size
`java.lang.Integer` | `getTrafficClass()` @return the value of TCP traffic class
`java.lang.String` | `getTrustStorePassword()` @return The trust store password
`java.lang.String` | `getTrustStorePath()` @return The trust store path
`java.lang.Boolean` | `isReuseAddress()` @return The value of TCP reuse address
`boolean` | `isSSL()` @return true if this server will make SSL connections
`java.lang.Boolean` | `isSoLinger()` @return the value of TCP so linger
`java.lang.Boolean` | `isTCPKeepAlive()` @return true if TCP keep alive is enabled
`java.lang.Boolean` | `isTCPNoDelay()` @return true if Nagle's algorithm is disabled.
`NetServer` | `listen(int port)` Instruct the server to listen for incoming connections on the specified `port` and all available interfaces.
`NetServer` | `listen(int port, java.lang.String host)` Instruct the server to listen for incoming connections on the specified `port` and `host`.
`NetServer` | `setAcceptBacklog(int backlog)` Set the accept backlog
`NetServer` | `setClientAuthRequired(boolean required)` Set `required` to true if you want the server to request client authentication from any connecting clients.
`NetServer` | `setKeyStorePassword(java.lang.String pwd)` Set the password for the SSL key store.
`NetServer` | `setKeyStorePath(java.lang.String path)` Set the path to the SSL key store.
`NetServer` | `setReceiveBufferSize(int size)` Set the TCP receive buffer size for connections created by this instance to `size` in bytes.
`NetServer` | `setReuseAddress(boolean reuse)` Set the TCP reuseAddress setting for connections created by this instance to `reuse`.
`NetServer` | `setSSL(boolean ssl)` If `ssl` is `true`, this signifies that any connections will be SSL connections.
`NetServer` | `setSendBufferSize(int size)` Set the TCP send buffer size for connections created by this instance to `size` in bytes.
`NetServer` | `setSoLinger(boolean linger)` Set the TCP soLinger setting for connections created by this instance to `reuse`.
`NetServer` | `setTCPKeepAlive(boolean keepAlive)` Set the TCP keepAlive setting for connections created by this instance to `keepAlive`.
`NetServer` | `setTCPNoDelay(boolean tcpNoDelay)` If `tcpNoDelay` is set to `true` then Nagle's algorithm will turned off for the TCP connections created by this instance.
`NetServer` | `setTrafficClass(int trafficClass)` Set the TCP trafficClass setting for connections created by this instance to `reuse`.
`NetServer` | `setTrustStorePassword(java.lang.String pwd)` Set the password for the SSL trust store.
`NetServer` | `setTrustStorePath(java.lang.String path)` Set the path to the SSL trust store.

Methods inherited from class java.lang.Object
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()

Field Detail

### jServer

    protected NetServer jServer

Method Detail

### close

    void close()

  Close the server. This will close any currently open connections.

### close

    void close(groovy.lang.Closure hndlr)

  Close the server. This will close any currently open connections. The event handler `done` will be called when the close is complete.

### connectHandler

    NetServer connectHandler(groovy.lang.Closure hndlr)

  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.
  Returns:
    a reference to this so multiple method calls can be chained together

### getAcceptBacklog

    java.lang.Integer getAcceptBacklog()

  Returns:
    The accept backlog

### getKeyStorePassword

    java.lang.String getKeyStorePassword()

  Returns:
    The keystore password

### getKeyStorePath

    java.lang.String getKeyStorePath()

  Returns:
    The path to the key store

### getReceiveBufferSize

    java.lang.Integer getReceiveBufferSize()

  Returns:
    The TCP receive buffer size

### getSendBufferSize

    java.lang.Integer getSendBufferSize()

  Returns:
    The TCP send buffer size

### getTrafficClass

    java.lang.Integer getTrafficClass()

  Returns:
    the value of TCP traffic class

### getTrustStorePassword

    java.lang.String getTrustStorePassword()

  Returns:
    The trust store password

### getTrustStorePath

    java.lang.String getTrustStorePath()

  Returns:
    The trust store path

### isReuseAddress

    java.lang.Boolean isReuseAddress()

  Returns:
    The value of TCP reuse address

### isSSL

    boolean isSSL()

  Returns:
    true if this server will make SSL connections

### isSoLinger

    java.lang.Boolean isSoLinger()

  Returns:
    the value of TCP so linger

### isTCPKeepAlive

    java.lang.Boolean isTCPKeepAlive()

  Returns:
    true if TCP keep alive is enabled

### isTCPNoDelay

    java.lang.Boolean isTCPNoDelay()

  Returns:
    true if Nagle's algorithm is disabled.

### listen

    NetServer listen(int port)

  Instruct the server to listen for incoming connections on the specified `port` and all available interfaces.
  Returns:
    a reference to this so multiple method calls can be chained together

### listen

    NetServer listen(int port, java.lang.String host)

  Instruct the server to listen for incoming connections on the specified `port` and `host`. `host` can be a host name or an IP address.
  Returns:
    a reference to this so multiple method calls can be chained together

### setAcceptBacklog

    NetServer setAcceptBacklog(int backlog)

  Set the accept backlog
  Returns:
    a reference to this so multiple method calls can be chained together

### setClientAuthRequired

    NetServer setClientAuthRequired(boolean required)

  Set `required` to true if you want the server to request client authentication from any connecting clients. This is an extra level of security in SSL, and requires clients to provide client certificates. Those certificates must be added to the server trust store.
  Returns:
    A reference to this, so multiple invocations can be chained together.

### setKeyStorePassword

    NetServer setKeyStorePassword(java.lang.String pwd)

  Set the password for the SSL key store. This method should only be used in SSL mode, i.e. after setSSL(boolean) has been set to `true`.

  Returns:
    A reference to this, so multiple invocations can be chained together.

### setKeyStorePath

    NetServer setKeyStorePath(java.lang.String path)

  Set the path to the SSL key store. This method should only be used in SSL mode, i.e. after setSSL(boolean) has been set to `true`.

  The SSL key store is a standard Java Key Store, and, if on the server side will contain the server certificate.

  Returns:
    A reference to this, so multiple invocations can be chained together.

### setReceiveBufferSize

    NetServer setReceiveBufferSize(int size)

  Set the TCP receive buffer size for connections created by this instance to `size` in bytes.
  Returns:
    a reference to this so multiple method calls can be chained together

### setReuseAddress

    NetServer setReuseAddress(boolean reuse)

  Set the TCP reuseAddress setting for connections created by this instance to `reuse`.
  Returns:
    a reference to this so multiple method calls can be chained together

### setSSL

    NetServer setSSL(boolean ssl)

  If `ssl` is `true`, this signifies that any connections will be SSL connections.
  Returns:
    A reference to this, so multiple invocations can be chained together.

### setSendBufferSize

    NetServer setSendBufferSize(int size)

  Set the TCP send buffer size for connections created by this instance to `size` in bytes.
  Returns:
    a reference to this so multiple method calls can be chained together

### setSoLinger

    NetServer setSoLinger(boolean linger)

  Set the TCP soLinger setting for connections created by this instance to `reuse`.
  Returns:
    a reference to this so multiple method calls can be chained together

### setTCPKeepAlive

    NetServer setTCPKeepAlive(boolean keepAlive)

  Set the TCP keepAlive setting for connections created by this instance to `keepAlive`.
  Returns:
    a reference to this so multiple method calls can be chained together

### setTCPNoDelay

    NetServer setTCPNoDelay(boolean tcpNoDelay)

  If `tcpNoDelay` is set to `true` then Nagle's algorithm will turned off for the TCP connections created by this instance.
  Returns:
    a reference to this so multiple method calls can be chained together

### setTrafficClass

    NetServer setTrafficClass(int trafficClass)

  Set the TCP trafficClass setting for connections created by this instance to `reuse`.
  Returns:
    a reference to this so multiple method calls can be chained together

### setTrustStorePassword

    NetServer setTrustStorePassword(java.lang.String pwd)

  Set the password for the SSL trust store. This method should only be used in SSL mode, i.e. after setSSL(boolean) has been set to `true`.

  Returns:
    A reference to this, so multiple invocations can be chained together.

### setTrustStorePath

    NetServer setTrustStorePath(java.lang.String path)

  Set the path to the SSL trust store. This method should only be used in SSL mode, i.e. after setSSL(boolean) has been set to `true`.

  The trust store is a standard Java Key Store, and should contain the certificates of any clients that the server trusts - this is only necessary if client authentication is enabled.

  Returns:
    A reference to this, so multiple invocations can be chained together.

Groovy Documentation