| 9 | #include <iperf_api.h> |
| 10 | |
| 11 | int |
| 12 | main( int argc, char** argv ) |
| 13 | { |
| 14 | char* argv0; |
| 15 | char* host; |
| 16 | int port; |
| 17 | struct iperf_test *test; |
| 18 | |
| 19 | argv0 = strrchr( argv[0], '/' ); |
| 20 | if ( argv0 != (char*) 0 ) |
| 21 | ++argv0; |
| 22 | else |
| 23 | argv0 = argv[0]; |
| 24 | |
| 25 | if ( argc != 3 ) { |
| 26 | fprintf( stderr, "usage: %s [host] [port]\n", argv0 ); |
| 27 | exit( EXIT_FAILURE ); |
| 28 | } |
| 29 | host = argv[1]; |
| 30 | port = atoi( argv[2] ); |
| 31 | |
| 32 | test = iperf_new_test(); |
| 33 | if ( test == NULL ) { |
| 34 | fprintf( stderr, "%s: failed to create test\n", argv0 ); |
| 35 | exit( EXIT_FAILURE ); |
| 36 | } |
| 37 | iperf_defaults( test ); |
| 38 | iperf_set_verbose( test, 1 ); |
| 39 | |
| 40 | iperf_set_test_role( test, 'c' ); |
| 41 | iperf_set_test_server_hostname( test, host ); |
| 42 | iperf_set_test_server_port( test, port ); |
| 43 | /* iperf_set_test_reverse( test, 1 ); */ |
| 44 | iperf_set_test_omit( test, 3 ); |
| 45 | iperf_set_test_duration( test, 5 ); |
| 46 | iperf_set_test_reporter_interval( test, 1 ); |
| 47 | iperf_set_test_stats_interval( test, 1 ); |
| 48 | /* iperf_set_test_json_output( test, 1 ); */ |
| 49 | |
| 50 | if ( iperf_run_client( test ) < 0 ) { |
| 51 | fprintf( stderr, "%s: error - %s\n", argv0, iperf_strerror( i_errno ) ); |
| 52 | exit( EXIT_FAILURE ); |
| 53 | } |
| 54 | |
| 55 | if (iperf_get_test_json_output_string(test)) { |
| 56 | fprintf(iperf_get_test_outfile(test), "%zd bytes of JSON emitted\n", |
| 57 | strlen(iperf_get_test_json_output_string(test))); |
| 58 | } |
| 59 | |
| 60 | iperf_free_test( test ); |
| 61 | exit( EXIT_SUCCESS ); |
| 62 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…