## net.i2p.client.streaming
Interface I2PSocket

All Known Implementing Classes:
  I2PSocketFull, I2PSocketImpl

public interface I2PSocket

Minimalistic adapter between the socket api and I2PTunnel's way. Note that this interface is a "subinterface" of the interface defined in the "official" streaming api.

Nested Class Summary
`static interface` `I2PSocket.SocketErrorListener` Allow notification of underlying errors communicating across I2P without waiting for any sort of cleanup process.

Method Summary
`void` `close()` Closes the socket if not closed yet
`java.io.InputStream` `getInputStream()` Return an InputStream to read from the socket.
`I2PSocketOptions` `getOptions()` Retrieve this socket's configuration
`java.io.OutputStream` `getOutputStream()` Return an OutputStream to write into the socket.
`Destination` `getPeerDestination()` Return the destination of the peer.
`long` `getReadTimeout()` How long we will wait blocked on a read() operation.
`Destination` `getThisDestination()` Return the Destination of this side of the socket.
`boolean` `isClosed()`
`void` `setOptions(I2PSocketOptions options)` Configure the socket
`void` `setReadTimeout(long ms)` Define how long we will wait blocked on a read() operation (-1 will make the socket wait forever).
`void` `setSocketErrorListener(I2PSocket.SocketErrorListener lsnr)`

Method Detail

### getThisDestination

    public Destination getThisDestination()

  Return the Destination of this side of the socket.

### getPeerDestination

    public Destination getPeerDestination()

  Return the destination of the peer.

### getInputStream

    public java.io.InputStream getInputStream()
                                       throws java.io.IOException

  Return an InputStream to read from the socket.

  Throws:
    `java.io.IOException`

### getOutputStream

    public java.io.OutputStream getOutputStream()
                                         throws java.io.IOException

  Return an OutputStream to write into the socket.

  Throws:
    `java.io.IOException`

### getOptions

    public I2PSocketOptions getOptions()

  Retrieve this socket's configuration

### setOptions

    public void setOptions(I2PSocketOptions options)

  Configure the socket

### getReadTimeout

    public long getReadTimeout()

  How long we will wait blocked on a read() operation. This is simply a helper to query the I2PSocketOptions

  Returns:
    milliseconds to wait, or -1 if we will wait indefinitely

### setReadTimeout

    public void setReadTimeout(long ms)

  Define how long we will wait blocked on a read() operation (-1 will make the socket wait forever). This is simply a helper to adjust the I2PSocketOptions

### close

    public void close()
               throws java.io.IOException

  Closes the socket if not closed yet

  Throws:
    `java.io.IOException`

### isClosed

    public boolean isClosed()

### setSocketErrorListener

    public void setSocketErrorListener(I2PSocket.SocketErrorListener lsnr)