return 0;
}
+static void randomize_buffer(char* buffer, size_t s) {
+ return; // TODO
+}
+
static int send_data_to_server(struct fireperf_config* conf, int fd) {
- char buffer[BUFFER_SIZE];
+ char buffer[BUFFER_SIZE] = { 0 };
ssize_t bytes_sent;
DEBUG(conf, "Sending %zu bytes of data to server\n", sizeof(buffer));
+ // Randomize the buffer if requested, otherwise just send an empty buffer
+ if (!conf->zero) {
+ randomize_buffer(buffer, sizeof(buffer));
+ }
+
do {
bytes_sent = send(fd, buffer, sizeof(buffer), 0);
} while (bytes_sent < 0 && (errno == EAGAIN || errno == EWOULDBLOCK));
{"port", required_argument, 0, 'p'},
{"server", no_argument, 0, 's'},
{"timeout", required_argument, 0, 't'},
+ {"zero", no_argument, 0, 'z'},
{0, 0, 0, 0},
};
int done = 0;
while (!done) {
- int c = getopt_long(argc, argv, "c:dp:st:P:", long_options, &option_index);
+ int c = getopt_long(argc, argv, "c:dp:st:zP:", long_options, &option_index);
// End
if (c == -1)
conf->timeout = strtoul(optarg, NULL, 10);
break;
+ case 'z':
+ conf->zero = 1;
+ break;
+
default:
done = 1;
break;