net.i2p.util

## Class InternalServerSocket

- java.lang.Object
- - java.net.ServerSocket
  - - net.i2p.util.InternalServerSocket

- All Implemented Interfaces:
    Closeable, AutoCloseable

      public class InternalServerSocket
      extends ServerSocket

  A simple in-JVM ServerSocket using Piped Streams. We use port numbers just like regular sockets. Can only be connected by InternalSocket. Warning - this uses Piped Streams, which don't like multiple writers from threads that may vanish. If you do use multiple writers, you may get intermittent 'write end dead' or 'pipe broken' IOExceptions on the reader side. See http://techtavern.wordpress.com/2008/07/16/whats-this-ioexception-write-end-dead/

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `InternalServerSocket(int port)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Socket` | `accept()`
    `void` | `close()`
    `ServerSocketChannel` | `getChannel()` Returns null as of 0.9.33, prior to that threw IllegalArgumentException
    `int` | `getLocalPort()`
    `int` | `getSoTimeout()`
    `(package private) static void` | `internalConnect(int port, InternalSocket clientSock)` This is how the client connects.
    `boolean` | `isBound()` Returns true as of 0.9.33, prior to that threw IllegalArgumentException
    `boolean` | `isClosed()` Supported as of 0.9.33, prior to that threw IllegalArgumentException
    `static void` | `renderStatusHTML(Writer out)` For debugging only
    `void` | `setSoTimeout(int timeout)` warning - unsupported
    `String` | `toString()`

    - ### Methods inherited from class java.net.ServerSocket

      `bind, bind, getInetAddress, getLocalSocketAddress, getReceiveBufferSize, getReuseAddress, implAccept, setPerformancePreferences, setReceiveBufferSize, setReuseAddress, setSocketFactory`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### InternalServerSocket

          public InternalServerSocket(int port)
                               throws IOException

      Parameters:
        `port` - > 0
      Throws:
        `IOException`

  - ### Method Detail

    - #### accept

          public Socket accept()
                        throws IOException

      Overrides:
        `accept` in class `ServerSocket`
      Throws:
        `IOException`

    - #### close

          public void close()

      Specified by:
        `close` in interface `Closeable`
      Specified by:
        `close` in interface `AutoCloseable`
      Overrides:
        `close` in class `ServerSocket`

    - #### getChannel

          public ServerSocketChannel getChannel()

      Returns null as of 0.9.33, prior to that threw IllegalArgumentException
      Overrides:
        `getChannel` in class `ServerSocket`

    - #### getLocalPort

          public int getLocalPort()

      Overrides:
        `getLocalPort` in class `ServerSocket`

    - #### getSoTimeout

          public int getSoTimeout()

      Overrides:
        `getSoTimeout` in class `ServerSocket`

    - #### internalConnect

          static void internalConnect(int port,
                                      InternalSocket clientSock)
                               throws IOException

      This is how the client connects.
      Parameters:
        `port` - > 0
      Throws:
        `IOException`

    - #### isBound

          public boolean isBound()

      Returns true as of 0.9.33, prior to that threw IllegalArgumentException
      Overrides:
        `isBound` in class `ServerSocket`

    - #### isClosed

          public boolean isClosed()

      Supported as of 0.9.33, prior to that threw IllegalArgumentException
      Overrides:
        `isClosed` in class `ServerSocket`

    - #### renderStatusHTML

          public static void renderStatusHTML(Writer out)
                                       throws IOException

      For debugging only
      Throws:
        `IOException`

    - #### setSoTimeout

          public void setSoTimeout(int timeout)

      warning - unsupported
      Overrides:
        `setSoTimeout` in class `ServerSocket`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `ServerSocket`