How to: trng_serveri

How to: trng_server

How to: trng_serverii

REVISION HISTORYNUMBER

DATE

1.1

2015-05

DESCRIPTIONNAMEKHow to: trng_serveriii

Contents

1Introduction

12

Preliminary steps

2

3

Basic usage with native client

3

4

Basic usage with java client

4

5

Client running on remote machine

5

6Multiple clients6How to: trng_server

1/6

Chapter 1

Introduction
trng_server is a simple command line program to get random data from Kidekin TRNG. Its command line arguments are fully
specified in trng_server.pdf. As trng_server is not very useful by itself, this document explain how to use it in conjunction withtrng_client. Command line arguments for trng_client are fully specified in trng_client.pdf. Before trying out this guide it isstrongly recommended to try how_to_trng_capture.pdf, it is simpler.

How to: trng_server

2/6

Chapter 2

Preliminary steps
The following steps are needed before attempting any of the other procedures.
1. Unzip the software package in a location where you have write permission
2. Plug in Kidekin TRNG
3. Open a console
4. Change directory to the location of the executables
a. Windows: application_notes_software\ftdi_d2xx\trng_client_server\build_dir
b. Linux (FTDI proprietary driver): application_notes_software\ftdi_d2xx\trng_client_server\build_dir_linux
c. Linux (libftdi):
i. application_notes_software\ftdi_d2xx\trng_client_server\build_dir_linux2
ii. sudo apt-get install libftdi1
On Window the executable should run on any system with FTDI driver installed. On Linux, if none of the executables run, youneed to rebuild them from source.
B UILDING L INUX EXECUTABLE WITH PROPRIETARY DRIVER
a. Change directory to application_notes_software\ftdi_d2xx\trng_client_server\
b. sudo apt-get install libusb-1.0-0-dev
c. Download and install Boost (the build script assume Boost 1.57.0 installed in /usr/local/lib)
d. If you have a different version of Boost or it is in a different location, adapt build.she. ./build.sh
The FTDI library requires GLIBC 2.2.5. It should be possible to use it on systems with other GLIBC versions but that’s fairly
involved in beyond the scope of this document. Building with libftdi (open source library) is way easier.
B UILDING L INUX EXECUTABLE WITH LIBFTDI OPEN SOURCE DRIVER
a. Change directory to application_notes_software\ftdi_d2xx\trng_client_server\
b. sudo apt-get install libftdi1
c. Download and install Boost (the build script assume Boost 1.57.0 installed in /usr/local/lib)
d. If you have a different version of Boost or it is in a different location, adapt build.she. ./build.shHow to: trng_server

3/6

Chapter 3

Basic usage with native client
This chapter explains how to connect a single native client running on the same machine as the server.
S INGLE MACHINE USAGE :1. launch the server on an available port:
a. Windows: trng_server 1234
b. Linux: sudo ./trng_server 1234
2. Open a second console
3. Change directory to the location of the executables
4. launch the client with local host as address and on the same port as the servera. Windows: trng_client 127.0.0.1 1234
b. Linux: ./trng_client 127.0.0.1 1234
5. At the client’s prompt, type "2" to request the creation of a file with 2 MB of random data
6. A file "reply_0.dat" should be created in the same directory as trng_client
If the port 1234 is not available on you machine, you can try another one, the essential thing is to use the same port for both theserver and the client.

How to: trng_server

Chapter 4

Basic usage with java client
This chapter explains how to connect a single java client running on the same machine as the server.
S INGLE MACHINE USAGE WITH JAVA CLIENT:
1. Make sure your computer has java installed.
a. You an check in a console by typing "java -version".
b. If necessary, install Java Runtime Environment (JRE).
2. Follow the procedure Single machine usage, but at step 4 invoke the java version of the client:a. java TrngClient 127.0.0.1 1234

4/6

How to: trng_server

5/6

Chapter 5

Client running on remote machineThis chapter explains how to connect a single client running on a different machine than the server. The procedure is the same asSingle machine usage however in practice it involves a bit of network setup too. Network configuration is a vast subject so thissection does not provide an exhaustive guide but rather few steps which may hep you to sort things out.
This procedure assume two machines connected to the same WIFI router.
R EMOTE CLIENT CONNECTION :1. Make sure the procedure Single machine usage work on the server machine. Let the trng_server running.
2. Get the IP address of the server machine:a. Windows:
i. type ipconfig in a console
ii. look for the entry corresponding to the connection with the WIFI router. For example "Wireless LAN adapter
Wi-Fi:".
iii. note the corresponding IP address. For example " IPv4 Address. . . . . . . . . . . : 192.168.0.36".
b. Linux: similar appraoch as in Windows. Command: ip addr show
3. On the client machine:a. Make sure that you can ping the server machine: ping <IP address>b. Launch trng_client with the server’s IP and the same port number as before.
c. Type 1 at trng_client’s prompt to do a quick check of the connection. If nothing happens after 10s it is likely that
there is a network setup problem.

About trng_client’s prompt
trng_client always display the prompt no matter if it can connect or not to the server (because it does not try beforereally having to).

How to: trng_server

6/6

Chapter 6

Multiple clients
This chapter explains how to connect multiple client to a single server. The procedure is the same as Single machine usage, juststart as many client as you which, possibly on diffrent machines. trng_server is not handling multiple connections in parallel,
but it process requests quickly therefore it is able to serve several clients one after another. Of course that cannot scale to a highnumber of clients, trng_server is not meant to be a public server, it should be used within private networks.

Figure 6.1: Several trng_client instances accessing the same trng_server in parallel
About multiple connections
Each client is getting different random numbers therefore trng_server bandwidth is divided among all connected clients.

Figure 6.2: Bandwidth is equally divided between each client