net.i2p.util

## Class InternalServerSocket

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

-     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 multipe 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/
  Since:
    0.7.9

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `InternalServerSocket(int port)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Socket` | `accept()`
    `void` | `bind(SocketAddress endpoint)` Deprecated. unsupported
    `void` | `bind(SocketAddress endpoint, int backlog)` Deprecated. unsupported
    `void` | `close()`
    `ServerSocketChannel` | `getChannel()` Deprecated. unsupported
    `InetAddress` | `getInetAddress()` Deprecated. unsupported
    `int` | `getLocalPort()`
    `SocketAddress` | `getLocalSocketAddress()` Deprecated. unsupported
    `int` | `getReceiveBufferSize()` Deprecated. unsupported
    `boolean` | `getReuseAddress()` Deprecated. unsupported
    `int` | `getSoTimeout()`
    `(package private) static void` | `internalConnect(int port, InternalSocket clientSock)` This is how the client connects.
    `boolean` | `isBound()` Deprecated. unsupported
    `boolean` | `isClosed()` Deprecated. unsupported
    `void` | `setReceiveBufferSize(int size)` Deprecated. unsupported
    `void` | `setReuseAddress(boolean on)` Deprecated. unsupported
    `void` | `setSoTimeout(int timeout)` warning - unsupported
    `String` | `toString()`

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

      `implAccept, setPerformancePreferences, 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

      Throws:
        `IOException`

  - ### Method Detail

    - #### close

          public void close()

      Overrides:
        `close` in class `ServerSocket`

    - #### accept

          public Socket accept()
                        throws IOException

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

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `ServerSocket`

    - #### internalConnect

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

      This is how the client connects. Todo: Java 1.5 PipedInputStream buffers are only 1024 bytes; our I2CP messages are typically 1730 bytes, thus causing thread blockage before the whole message is transferred. We can specify buffer size in 1.6 but not in 1.5. Does wrapping the PipedOutputStreams in BufferedOutputStreams gain capacity? No?
      Throws:
        `IOException`

    - #### getLocalPort

          public int getLocalPort()

      Overrides:
        `getLocalPort` in class `ServerSocket`

    - #### setSoTimeout

          public void setSoTimeout(int timeout)

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

    - #### getSoTimeout

          public int getSoTimeout()

      Overrides:
        `getSoTimeout` in class `ServerSocket`

    - #### bind

          public void bind(SocketAddress endpoint)

      Deprecated. unsupported
      Overrides:
        `bind` in class `ServerSocket`

    - #### bind

          public void bind(SocketAddress endpoint,
                  int backlog)

      Deprecated. unsupported
      Overrides:
        `bind` in class `ServerSocket`

    - #### getChannel

          public ServerSocketChannel getChannel()

      Deprecated. unsupported
      Overrides:
        `getChannel` in class `ServerSocket`

    - #### getInetAddress

          public InetAddress getInetAddress()

      Deprecated. unsupported
      Overrides:
        `getInetAddress` in class `ServerSocket`

    - #### getLocalSocketAddress

          public SocketAddress getLocalSocketAddress()

      Deprecated. unsupported
      Overrides:
        `getLocalSocketAddress` in class `ServerSocket`

    - #### getReceiveBufferSize

          public int getReceiveBufferSize()

      Deprecated. unsupported
      Overrides:
        `getReceiveBufferSize` in class `ServerSocket`

    - #### getReuseAddress

          public boolean getReuseAddress()

      Deprecated. unsupported
      Overrides:
        `getReuseAddress` in class `ServerSocket`

    - #### isBound

          public boolean isBound()

      Deprecated. unsupported
      Overrides:
        `isBound` in class `ServerSocket`

    - #### isClosed

          public boolean isClosed()

      Deprecated. unsupported
      Overrides:
        `isClosed` in class `ServerSocket`

    - #### setReceiveBufferSize

          public void setReceiveBufferSize(int size)

      Deprecated. unsupported
      Overrides:
        `setReceiveBufferSize` in class `ServerSocket`

    - #### setReuseAddress

          public void setReuseAddress(boolean on)

      Deprecated. unsupported
      Overrides:
        `setReuseAddress` in class `ServerSocket`