# Package net.i2p.client.streaming

API, interfaces, and factory for a TCP-like (reliable, authenticated, in order) set of sockets for communicating over IP-like (unreliable, unauthenticated, unordered) I2P messages.

See: Description

- Interface Summary
  Interface | Description
  --- | ---
  I2PServerSocket | Streaming server socket returned by `I2PSocketManager.getServerSocket()`.
  I2PSocket | Streaming socket returned by `I2PSocketManager.connect(Destination)`.
  I2PSocket.SocketErrorListener | Deprecated, unimplemented, does nothing.
  I2PSocketManager | Centralize the coordination and multiplexing of the local client's streaming.
  I2PSocketManager.DisconnectListener | Listener for notification when an I2P session is disconnected
  I2PSocketOptions | Define the configuration for streaming and verifying data on the socket.
  IncomingConnectionFilter | Something that filters incoming streaming connections.
  StatefulConnectionFilter | A ConnectionFilter that may hold state, can be started and stopped

- Class Summary
  Class | Description
  --- | ---
  AcceptingChannel | As this does not (yet) extend ServerSocketChannel it cannot be returned by StandardServerSocket.getChannel(), until we implement an I2P SocketAddress class.
  I2PSocketAddress | A SocketAddress (Destination + port) so we can have SocketChannels.
  I2PSocketEepGet | Fetch a URL using a socket from the supplied I2PSocketManager.
  I2PSocketManagerFactory | Simplify the creation of I2PSession and transient I2P Destination objects if necessary to create a socket manager.

- Exception Summary
  Exception | Description
  --- | ---
  I2PSocketException | An I2P-specific IOException thrown from input and output streams, with a stored status code to be used for programmatic responses.
  RouterRestartException | An I2PException thrown from I2PServerSocket.accept() when the router is restarting.

## Package net.i2p.client.streaming Description

API, interfaces, and factory for a TCP-like (reliable, authenticated, in order) set of sockets for communicating over IP-like (unreliable, unauthenticated, unordered) I2P messages. Note that this class is split across two jars, streaming.jar and ministreaming.jar. The interfaces are in ministreaming.jar, but the real work gets done in streaming.jar. Clients must have both jars in their classpath. Most clients will require (only) streaming.jar, ministreaming.jar, and i2p.jar in their classpath to communicate with the router.

When an application wants to use streams, it must fetch an `I2PSocketManager` from `I2PSocketManagerFactory`, which in turn builds its own `I2PSession` internally. All communication over that `I2PSession` is handled by `I2PSocketManager`, as it imposes its own formatting on raw messages sent and received. If an application wants to receive streams from other clients on network, it should access the blocking `I2PServerSocket.accept()` method, which will provide an `I2PSocket` when a new one is available. If an application wants to create a new stream to a peer, it should do so with the appropriate `I2PSocketManager.connect(net.i2p.data.Destination, net.i2p.client.streaming.I2PSocketOptions)` call.

This package also contains I2PSocketEepGet utility, which is an HTTP client that uses an existing I2PSocketManager.

There is a simple pair of demo applications available in test directory - net.i2p.client.streaming.StreamSinkServer listens to a destination and dumps data from all sockets it accepts to individual files, while net.i2p.client.streaming.StreamSinkClient connects to a particular destination and sends a specific amount of random data then disconnects.