From c59fd3c2169df1c389b1e806bced16c78d47a6c5 Mon Sep 17 00:00:00 2001 From: Mark Nellemann Date: Wed, 5 Jul 2023 15:52:45 +0200 Subject: [PATCH] Update README with examples. --- README.md | 44 +++++++++++++------ .../biz/nellemann/jnetperf/Application.java | 14 +++--- 2 files changed, 39 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index f077bdc..5ba201e 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 @@ -9,21 +9,39 @@ 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** +- 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. 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;