Suppoet for TCP #1

Merged
nellemann merged 3 commits from tcp into main 2023-07-14 05:42:12 +00:00
2 changed files with 38 additions and 20 deletions
Showing only changes of commit 0062763439 - Show all commits

View file

@ -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:

View file

@ -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<Integer> {
@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;