Commit 5395e31e authored by Andreas Schmidt's avatar Andreas Schmidt
Browse files

Add local port as parameter to sender.

parent e43934d4
Pipeline #1595 passed with stages
in 1 minute and 31 seconds
......@@ -8,12 +8,13 @@
static char doc[] = "PRRT Sender";
static struct argp_option options[] = {
{"target", 't', "HOST", 0, "Target Host" },
{"port", 'p', "PORT", 0, "Target Port" },
{"rounds", 'r', "ROUNDS", 0, "Rounds" },
{"output", 'o', "FILE", 0, "Output to FILE instead of standard output" },
{"threadpinning", 'T', 0, 0, "Enable thread pinning"},
{"hardwaretimestamping", 777, "INTERFACE", 0, "Enable hardware timestamping and bind to interface"},
{"target", 't', "HOST", 0, "Target Host" },
{"port", 'p', "PORT", 0, "Target Port" },
{"local port", 'l', "PORT", 0, "Local Port" },
{"rounds", 'r', "ROUNDS", 0, "Rounds" },
{"output", 'o', "FILE", 0, "Output to FILE instead of standard output" },
{"threadpinning", 'T', 0, 0, "Enable thread pinning"},
{"hardwaretimestamping", 777, "INTERFACE", 0, "Enable hardware timestamping and bind to interface"},
{ 0 }
};
......@@ -21,6 +22,7 @@ static struct arguments
{
char* target;
uint16_t port;
uint16_t local_port;
uint16_t rounds;
char* outfile;
bool thread_pinning;
......@@ -42,6 +44,9 @@ static error_t parse_opt (int key, char *arg, struct argp_state *state)
case 'p':
arguments->port = (uint16_t) strtol(arg, &pEnd, 10);
break;
case 'l':
arguments->local_port = (uint16_t) strtol(arg, &pEnd, 10);
break;
case 'r':
arguments->rounds = (uint16_t) strtol(arg, &pEnd, 10);
break;
......@@ -71,6 +76,7 @@ int main(int argc, char **argv) {
struct arguments arguments = {
.target = "127.0.0.1",
.port = 5000,
.local_port = 6000,
.rounds = 127,
.outfile = "-",
.thread_pinning = false,
......@@ -95,7 +101,6 @@ int main(int argc, char **argv) {
#endif
uint16_t local_port = 6000;
PrrtSocket *s = PrrtSocket_create(true, 60 * 1000 * 1000);
check(s != NULL, "Socket create failed.");
......@@ -107,7 +112,7 @@ int main(int argc, char **argv) {
PrrtSocket_enable_thread_pinning(s);
}
check(PrrtSocket_bind(s, "0.0.0.0", local_port), "bind failed");
check(PrrtSocket_bind(s, "0.0.0.0", arguments.local_port), "bind failed");
//PrrtSocket_set_coding_parameters(s, 1, 1); // comment this line to re-enable coding.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment