Skip to content

Commit

Permalink
Send empty packet before initial delay.
Browse files Browse the repository at this point in the history
  • Loading branch information
bluhm committed Jan 21, 2024
1 parent 363b872 commit 15e92af
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion udpbench.1
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@ With dynamic
.Ic ssh
the option is passed to the remote process.
.It Fl d Ar delay
Sleep some seconds before sending packets.
Sleep some seconds before sending packets with payload.
This is useful to wait for setup of multiple processes via ssh.
An initial empty packet is sent before delay to trigger setup.
Default is 0 seconds which disables the feature.
.It Fl H
Use IPv6 hop-by-hop option by adding a router alert when sending.
Expand Down
5 changes: 4 additions & 1 deletion udpbench.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,11 @@ udp_connect_send(void)
bitrate, etherlen);
} else
sendrate = packetrate;
if (delay)
if (delay) {
if (send(udp_socket, "", 0, 0) == -1)
err(1, "send initial");
sleep(delay);
}
if (timeout > 0)
alarm(timeout);
udp_send(udp_socket, udp_family, sendrate);
Expand Down

0 comments on commit 15e92af

Please sign in to comment.