# Package net.i2p.client

Interfaces and factories for the base I2P SDK used to develop applications that communicate through I2P.

See: Description

- Interface Summary
  Interface | Description
  --- | ---
  I2PClient | Define the standard means of interacting with the I2P system An I2PClient contains no state, it is just a facility for creating private key files and generating sesssions from existing private key files.
  I2PSession | Define the standard means of sending and receiving messages on the I2P network by using the I2CP (the client protocol).
  I2PSessionListener | Define a means for the router to asynchronously notify the client that a new message is available or the router is under attack.
  I2PSessionMuxedListener | Define a means for the router to asynchronously notify the client that a new message is available or the router is under attack.
  LookupCallback | Deferred callback for IPSession.lookupNonblocking()
  LookupResult | The return value of I2PSession.lookupDest2()
  SendMessageStatusListener | Asynchronously notify the client of the status of a sent message.

- Class Summary
  Class | Description
  --- | ---
  I2PClientFactory | Provide a means of hooking into an appropriate I2PClient implementation
  I2PSimpleClient | Simple client implementation with no Destination, just used to talk to the router.
  SendMessageOptions | Advanced options attached to a single outgoing I2CP message.

- Enum Summary
  Enum | Description
  --- | ---
  SendMessageOptions.GzipOption | Overrides i2cp.gzip session option and size threshold for this message only.
  SendMessageOptions.Reliability | Reliability bits 9-10

- Exception Summary
  Exception | Description
  --- | ---
  I2PSessionException | Thrown when there is a problem doing something on the session

## Package net.i2p.client Description

Interfaces and factories for the base I2P SDK used to develop applications that communicate through I2P.

Implementation moved to net.i2p.client.impl in 0.9.21.

When a client application wants to communicate over I2P, the first thing it needs to do is get a `I2PClient` from the `I2PClientFactory`. If it does not already have a `Destination`, it must generate one with the `I2PClient.createDestination(java.io.OutputStream)` before proceeding. Once it has one, it then creates an `I2PSession` which serves as the bridge to the I2P network, allowing it to send messages (via `I2PSession.sendMessage(net.i2p.data.Destination, byte[])`) and receive messages (via `I2PSession.receiveMessage(int)`). In addition, the client receives asynchronous notification of network activity by providing an implementation of `I2PSessionListener`.

This client package provides the basic necessity for communicating over I2P, but there are three other subpackages that are helpful. Specifically:

- `net.i2p.client.datagram` - for applications that want their messages to be both authenticated and repliable
- `net.i2p.client.naming` - for applications that want to resolve readable names into `Destination`s
- net.i2p.client.streaming - for applications that want to use a streaming API to provide reliable in order message delivery (note: the streaming library is packaged seperate from the main SDK - in the mstreaming.jar and streaming.jar)

The `I2PSession` implementation itself communicates with the I2P router by the I2CP (the client protocol).