diff --git a/README.md b/README.md index f077bdc..d0f13c7 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# jPerf +# jnetperf -Small utility to measure network performance between two hosts. +Small utility to measure (single threaded) network performance between two hosts. ## Requirements @@ -8,26 +8,42 @@ You need Java (JRE) version 8 or later to run jnetperf. ## Usage Instructions -- Install the jnetperf package (*.deb*, *.rpm* or *.jar*) from [downloads](https://bitbucket.org/mnellemann/jnetperf/downloads/) or compile from source. -- Run **/opt/jnetperf/bin/jperf**, if installed from package -- Or as **java -jar /path/to/jnetperf.jar** +- Install the jnetperf package (*.deb*, *.rpm* or *.jar*) from [Packages](https://git.data.coop/nellemann/jnetperf/packages) or compile from source. +- Run **/opt/jnetperf/bin/jperf**, if installed from package, or as **java -jar /path/to/jnetperf.jar** ```shell -Usage: jnetperf [-hV] [-l=SIZE] [-n=NUM] [-p=PORT] (-c=HOST | -s) -Network Performance Testing. - -c, --connect=HOST Connect to remote server - -h, --help Show this help message and exit. - -l, --pkt-len=SIZE Datagram size in bytes, max 65507 [default: 65507] - -n, --pkt-num=NUM Number of packets to send [default: 150000] - -p, --port=PORT Network port [default: 4445] - -s, --server Run server and wait for client - -V, --version Print version information and exit. +Usage: jnetperf [-hV] [-l=SIZE] [-n=NUM] [-p=PORT] (-c=SERVER | -s) +For more information visit https://git.data.coop/nellemann/jnetperf + -c, --connect=SERVER Connect to remote server. + -h, --help Show this help message and exit. + -l, --pkt-len=SIZE Datagram size in bytes, max 65507 [default: 65507]. + -n, --pkt-num=NUM Number of packets to send [default: 150000]. + -p, --port=PORT Network port [default: 4445]. + -s, --server Run server and wait for client. + -V, --version Print version information and exit. ``` + +## Examples + +On *host A* run jnetperf as a server waiting for a connection from a client: + +```shell +java -jar jnetperf-x.y.z-all.jar -s +``` + +On *host B* run jnetperf as a client connecting to the server and sending data: + +```shell +java -jar jnetperf-x.y.z-all.jar -c server-ip +``` + + ## Development Information You need Java (JDK) version 8 or later to build jnetperf. + ### Build & Test Use the gradle build tool, which will download all required dependencies: diff --git a/src/main/java/biz/nellemann/jnetperf/Application.java b/src/main/java/biz/nellemann/jnetperf/Application.java index 5069210..a2744ee 100644 --- a/src/main/java/biz/nellemann/jnetperf/Application.java +++ b/src/main/java/biz/nellemann/jnetperf/Application.java @@ -24,27 +24,29 @@ import java.net.SocketException; import java.util.concurrent.Callable; -@Command(name = "jnetperf", mixinStandardHelpOptions = true, versionProvider = VersionProvider.class, description = "Network Performance Testing.") +@Command(name = "jnetperf", mixinStandardHelpOptions = true, + versionProvider = VersionProvider.class, + description = "For more information visit https://git.data.coop/nellemann/jnetperf") public class Application implements Callable { @CommandLine.ArgGroup(exclusive = true, multiplicity = "1") RunMode runMode; static class RunMode { - @CommandLine.Option(names = { "-c", "--connect" }, required = true, description = "Connect to remote server", paramLabel = "HOST") + @CommandLine.Option(names = { "-c", "--connect" }, required = true, description = "Connect to remote server.", paramLabel = "SERVER") String remoteServer; - @CommandLine.Option(names = { "-s", "--server" }, required = true, description = "Run server and wait for client") + @CommandLine.Option(names = { "-s", "--server" }, required = true, description = "Run server and wait for client.") boolean runServer = false; } - @CommandLine.Option(names = { "-l", "--pkt-len" }, paramLabel = "SIZE", description = "Datagram size in bytes, max 65507 [default: ${DEFAULT-VALUE}]") + @CommandLine.Option(names = { "-l", "--pkt-len" }, paramLabel = "SIZE", description = "Datagram size in bytes, max 65507 [default: ${DEFAULT-VALUE}].") int packetSize = 65507; // Min: 256 Max: 65507 - @CommandLine.Option(names = { "-n", "--pkt-num" }, paramLabel = "NUM", description = "Number of packets to send [default: ${DEFAULT-VALUE}]") + @CommandLine.Option(names = { "-n", "--pkt-num" }, paramLabel = "NUM", description = "Number of packets to send [default: ${DEFAULT-VALUE}].") int packetCount = 150_000; - @CommandLine.Option(names = { "-p", "--port" }, paramLabel = "PORT", description = "Network port [default: ${DEFAULT-VALUE}]") + @CommandLine.Option(names = { "-p", "--port" }, paramLabel = "PORT", description = "Network port [default: ${DEFAULT-VALUE}].") int port = 4445;