Package: java.net

## [Java] Class ServerSocket

- java.net.ServerSocket

-     public class ServerSocket
      extends Object

  GDK enhancements for ServerSocket.

  displayName:
    ServerSocket
  receiverFqcn:
    java.net.ServerSocket

- - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public Socket` | `accept(Closure closure)` Accepts a connection and passes the resulting Socket to the closure which runs in a new Thread.
    `` | `public Socket` | `accept(boolean runInANewThread, Closure closure)` Accepts a connection and passes the resulting Socket to the closure which runs in a new Thread or the calling thread, as needed.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `addShutdownHook, any, any, asBoolean, asType, collect, collect, collect, dump, each, eachMatch, eachMatch, eachWithIndex, every, every, find, find, findAll, findAll, findIndexOf, findIndexOf, findIndexValues, findIndexValues, findLastIndexOf, findLastIndexOf, findResult, findResult, findResult, findResult, getAt, getMetaClass, getMetaPropertyValues, getProperties, grep, grep, hasProperty, identity, inject, inject, inspect, invokeMethod, is, isCase, isNotCase, iterator, metaClass, print, print, printf, printf, println, println, println, putAt, respondsTo, respondsTo, setMetaClass, sleep, sleep, split, sprintf, sprintf, stream, tap, toString, use, use, use, with, with, withCloseable, withCloseable, withMethodClosure, withStream, withStream, withTraits`

- - ### Method Detail

    - #### public Socket accept(Closure closure)

      Accepts a connection and passes the resulting Socket to the closure which runs in a new Thread.

      throws:
        IOException if an IOException occurs.
      Parameters:
        `closure` - a Closure
      Returns:
        a Socket
      See Also:
        ServerSocket.accept
      Since:
        1.0

    - #### public Socket accept(boolean runInANewThread, Closure closure)

      Accepts a connection and passes the resulting Socket to the closure which runs in a new Thread or the calling thread, as needed.

      throws:
        IOException if an IOException occurs.
      Parameters:
        `runInANewThread` - This flag should be true, if the closure should be invoked in a new thread, else false.
        `closure` - a Closure
      Returns:
        a Socket
      See Also:
        ServerSocket.accept
      Since:
        1.7.6