diff --git a/src/iperf_client_api.c b/src/iperf_client_api.c index 0976b07..866d446 100644 --- a/src/iperf_client_api.c +++ b/src/iperf_client_api.c @@ -381,9 +381,12 @@ iperf_run_client(struct iperf_test * test) if (startup) { startup = 0; - SLIST_FOREACH(sp, &test->streams, streams) { - setnonblocking(sp->socket, 1); - } + // If the client is sending (normal mode) then set nonblocking sockets + if (!test->reverse) { + SLIST_FOREACH(sp, &test->streams, streams) { + setnonblocking(sp->socket, 1); + } + } } if (test->reverse) { @@ -406,9 +409,12 @@ iperf_run_client(struct iperf_test * test) (test->settings->bytes != 0 && test->bytes_sent >= test->settings->bytes) || (test->settings->blocks != 0 && test->blocks_sent >= test->settings->blocks))) { - SLIST_FOREACH(sp, &test->streams, streams) { - setnonblocking(sp->socket, 0); - } + // If the client is sending (normal mode) then undo nonblocking sockets + if (!test->reverse) { + SLIST_FOREACH(sp, &test->streams, streams) { + setnonblocking(sp->socket, 0); + } + } /* Yes, done! Send TEST_END. */ test->done = 1; diff --git a/src/iperf_server_api.c b/src/iperf_server_api.c index e522ca6..83a7cb1 100644 --- a/src/iperf_server_api.c +++ b/src/iperf_server_api.c @@ -516,7 +516,10 @@ iperf_run_server(struct iperf_test *test) FD_SET(s, &test->read_set); if (s > test->max_fd) test->max_fd = s; - setnonblocking(s, 1); + // If the server is sending (reverse mode) then set nonblocking sockets + if (test->reverse) { + setnonblocking(s, 1); + } streams_accepted++; if (test->on_new_stream)