# Package net.i2p.client.streaming

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

See: Description

- Interface Summary
  Interface | Description
  --- | ---
  ConnectionManager.PingNotifier |
  I2PServerSocket | Defines how to listen for streaming peer connections
  I2PSocket | Minimalistic adapter between the socket api and I2PTunnel's way.
  I2PSocket.SocketErrorListener | Allow notification of underlying errors communicating across I2P without waiting for any sort of cleanup process.
  I2PSocketManager | Centralize the coordination and multiplexing of the local client's streaming.
  I2PSocketManager.DisconnectListener |
  I2PSocketOptions | Define the configuration for streaming and verifying data on the socket.
  MessageOutputStream.DataReceiver | Define a component to receive data flushed from this stream
  MessageOutputStream.WriteStatus | Define a way to detect the status of a write
  TaskScheduler | Coordinates what we do 'next'.

- Class Summary
  Class | Description
  --- | ---
  ByteCollector | Deprecated Only used by deprecated I2PSocketImpl
  Connection | Maintain the state controlling a streaming connection between two destinations.
  ConnectionDataReceiver | Receive data from the MessageOutputStream, build a packet, and send it through a connection.
  ConnectionHandler | Receive new connection attempts Use a bounded queue to limit the damage from SYN floods, router overload, or a slow client
  ConnectionManager | Coordinate all of the connections for a single local destination.
  ConnectionOptions | Define the current options for the con (and allow custom tweaking midstream)
  ConnectionPacketHandler | Receive a packet for a particular connection - placing the data onto the queue, marking packets as acked, updating various fields, etc.
  ConnThrottler | Count how often we have received an incoming connection This offers basic DOS protection but is not a complete solution.
  I2PServerSocketFull | Bridge to allow accepting new connections
  I2PServerSocketImpl | Deprecated use I2PServerSocketFull
  I2PSocketEepGet | Fetch a URL using a socket from the supplied I2PSocketManager.
  I2PSocketFull | Bridge between the full streaming lib and the I2PSocket API
  I2PSocketImpl | Deprecated use I2PSocketFull
  I2PSocketManagerFactory | Simplify the creation of I2PSession and transient I2P Destination objects if necessary to create a socket manager.
  I2PSocketManagerFull | Centralize the coordination and multiplexing of the local client's streaming.
  I2PSocketManagerImpl | Deprecated use I2PSocketManagerFull
  I2PSocketOptionsImpl | Define the configuration for streaming and verifying data on the socket.
  MessageHandler | Receive raw information from the I2PSession and turn it into Packets, if we can.
  MessageInputStream | Stream that can be given messages out of order yet present them in order.
  MessageOutputStream | A stream that we can shove data into that fires off those bytes on flush or when the buffer is full.
  Packet | Contain a single packet transferred as part of a streaming connection.
  PacketHandler | receive a packet and dispatch it correctly to the connection specified, the server socket, or queue a reply RST packet.
  PacketLocal | coordinate local attributes about a packet - send time, ack time, number of retries, etc.
  PacketQueue | Queue out packets to be sent through the session.
  RetransmissionTimer | Not clear that we really need to create our own timer group, but we do, to prevent us clogging the router's timer group.
  SchedulerChooser | Examine a connection's state and pick the right scheduler for it.
  SchedulerClosed | Scheduler used for after both sides have had their close packets ACKed, but the final timeout hasn't passed.
  SchedulerClosing | Scheduler used for after both SYNs have been ACKed and both sides have closed the stream, but either we haven't ACKed their close or they haven't ACKed ours.
  SchedulerConnectedBulk | Scheduler used for after our SYN has been sent and ACKed but one (or more) sides haven't closed the stream yet.
  SchedulerConnecting | Scheduler used once we've sent our SYN but it hasn't been ACKed yet.
  SchedulerDead | Scheduler used for after the final timeout has passed or the connection was reset.
  SchedulerHardDisconnected | Scheduler used after we've locally done a hard disconnect, but the final timeout hasn't passed.
  SchedulerImpl | Base scheduler
  SchedulerPreconnect | Scheduler used for locally created connections where we have not yet sent the initial SYN packet.
  SchedulerReceived | Scheduler used after receiving an inbound connection but before we have sent our own SYN.
  StandardServerSocket | Bridge to I2PServerSocket.
  StandardSocket | Bridge to I2PSocket.
  TCBShare | Share important TCP Control Block parameters across Connections to the same remote peer.

- Exception Summary
  Exception | Description
  --- | ---
  TooManyStreamsException | We attempted to have more open streams than we are willing to put up with

## Package net.i2p.client.streaming Description

Implements a TCP-like (reliable, authenticated, in order) set of sockets for communicating over the IP-like (unreliable, unauthenticated, unordered) I2P messages. Note that this class is split across two jars, streaming.jar and ministreaming.jar. The interfaces and some very old code 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 the `I2PSocketManagerFactory`, which in turn builds its own `I2PSession` internally. All communication over that `I2PSession` is handled by the `I2PSocketManager`, as it imposes its own formatting on the raw messages sent and received. If an application wants to receive streams from other clients on the 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.

There is a simple pair of demo applications available as well - net.i2p.client.streaming.StreamSinkServer listens to a destination and dumps the 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.