CLI - rsandila/traffic3 GitHub Wiki
If you run the CLI without any command-line parameters then it should print help. For the 3.1.0 release it should look something like this.
usage: ./bin/64bit/Debug/traffic3 --mode=string --port=unsigned int [options] ...
options:
-o, --mode Mode [server|client|rest] (string)
-r, --protocol Protocol [tcp4|udp4|tcp6|udp6] (string [=tcp4])
-t, --type ContentManager type [randomtext|randombinary|fixed|echo] (string [=randomtext])
-p, --port Port to connect to or listen on (unsigned int)
-m, --min Minimum value to configure contentmanager with (unsigned int [=100])
-a, --max Maximum value to configure contentmanager with (unsigned int [=100000])
-h, --host Host to connect to (string [=127.0.0.1])
-c, --count Number of clients to use (unsigned int [=1])
-i, --interface Interface IP to listen on (string [=0.0.0.0])
-e, --rest_content Folder containing static files to server (string [=/tmp/static])
-?, --help print this message
In a network architecture you generally have one or more clients communicating with one server. Traffic3 follows the same pattern. You have to start one instance of the CLI as server and then one or more instances of the client on the other side of the firewall/router that you are testing. The purpose of the -o
or --mode
switch is to select client, server or rest mode.
The following command will run in REST mode exposing the HTML/JS UI: ./bin/32bit/Debug/traffic3 -o rest -p 10000 -e src/main/rest-ui/
. It will listen on port 10000 on localhost (127.0.0.1).
The -r
or --protocol
switch selects the protocol. The choices are
- udp4
- udp6
- tcp4
- tcp6
For TCP the server will create one thread per client connection. For UDP the server will only create one thread independent of the number of clients.
The -t
or --type
switch is used to select the type of data to be generated. For more information refer to Content-Managers. The meanings of -m
, --min
, -a
and --max
are also described there.
The -p
or --port
switch is interpreted differently depending on the mode of the instance. In server mode the instance will listen on that port. In client mode it will try to connect to a server on the specified port. Please ensure that nothing else is listening on the specified port before trying to listen on it.
The -h
or --host
switch is used only in client mode. The client will try to connect using the specified protocol on the host and port specified.
The -c
or --count
switch is used only in client mode. It specifies the number of client threads to use to connect to a server on the specified host, port and protocol using the specified content manager.
The -i
or --interface
switch is used only in server mode. It specifies the interface the server should listen on with the specified port. 0.0.0.0
is good enough to listen for all IPV4 connections. To listen for both IPV4 and IPV6 connections you can specify "::" and a tcp6/udp6 protocol.
The -e
or --rest_content
switch is only used in rest mode. It specifies a folder that will be used to serve static files. For example the HTML/JS files used for the UI.
By default the CLI will run until any key is pressed. If it was unable to connect/listen then it will print an error messages and still wait for any key to be pressed.