From f2bb84c45fddecad18eaefa9dbe84b14a0fb3841 Mon Sep 17 00:00:00 2001
From: str4d
+{% highlight lang='java' %} package i2p.echoserver; import net.i2p.client.I2PSession; @@ -322,8 +322,7 @@ In addition, we will ask the I2PSocketManager for an I2PSession, so we can find } } --
{{ _('Code example 1: initializing the server application.') }}
{% trans -%} @@ -335,11 +334,10 @@ Once we have created the I2PSocket instance, we read data, print it and send it The bold code is the new code we add. {%- endtrans %}
+{% highlight lang='java', +hl_lines=[3,4,5,6,7,8,9,10,25,26,27,28,29,32,34,35,36,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,65,67] %} package i2p.echoserver; --
import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -348,8 +346,7 @@ The bold code is the new code we add. import net.i2p.I2PException; import net.i2p.client.streaming.I2PSocket; import net.i2p.util.I2PThread; --
+ import net.i2p.client.I2PSession; import net.i2p.client.streaming.I2PServerSocket; import net.i2p.client.streaming.I2PSocketManager; @@ -362,8 +359,6 @@ The bold code is the new code we add. I2PServerSocket serverSocket = manager.getServerSocket(); I2PSession session = manager.getSession(); System.out.println(session.getMyDestination().toBase64()); //Print the base64 string, the regular string would look like garbage. --
//Create socket to handle clients I2PThread t = new I2PThread(new ClientHandler(serverSocket)); @@ -410,8 +405,7 @@ The bold code is the new code we add. } } --
{{ _('Code example 2: accepting connections from clients and handling messages.') }}
+{% highlight lang='java' %} package i2p.echoclient; import java.io.BufferedReader; @@ -514,8 +508,7 @@ Once we have an I2PSocket, we can start sending and receiving data to and from t } } --
{{ _('Code example 3: starting the client and connecting it to the server application.') }}
{% trans -%}