1LIBIPERF(3)                      User Manuals                      LIBIPERF(3)
2
3
4

NAME

6       libiperf - API for iperf3 network throughput tester
7
8

SYNOPSIS

10       #include <iperf_api.h>
11       -liperf
12
13

DESCRIPTION

15       Libiperf  gives  you access to all the functionality of the iperf3 net‐
16       work testing tool.  You can build it directly into  your  own  program,
17       instead of having to run it as a shell command.
18
19

CALLS

21       Initialization / termination:
22           struct iperf_test *iperf_new_test();
23           int iperf_defaults(struct iperf_test *t);
24           void iperf_free_test(struct iperf_test *t);
25       Setting test parameters:
26           void iperf_set_test_role( struct iperf_test *pt, char role );
27           void iperf_set_test_bind_address( struct iperf_test *t, char *bind_address );
28           void iperf_set_test_server_hostname( struct iperf_test *t, char *server_host );
29           void iperf_set_test_server_port( struct iperf_test *t, int server_port );
30           void iperf_set_test_duration( struct iperf_test *t, int duration );
31           void iperf_set_test_blksize( struct iperf_test *t, int blksize );
32           void iperf_set_test_num_streams( struct iperf_test *t, int num_streams );
33           void iperf_set_test_json_output( struct iperf_test *t, int json_output );
34           int iperf_has_zerocopy( void );
35           void iperf_set_test_zerocopy( struct iperf_test* t, int zerocopy );
36       Running a test:
37           int iperf_run_client(struct iperf_test *);
38           int iperf_run_server(struct iperf_test *);
39           void iperf_test_reset(struct iperf_test *);
40       Output:
41           FILE *iperf_get_test_outfile(struct iperf_test *);
42           char* iperf_get_test_json_output_string(struct iperf_test *);
43       Error reporting:
44           void iperf_err(struct iperf_test *t, const char *format, ...);
45           char *iperf_strerror(int);
46           extern int i_errno;
47       This  is  not  a complete list of the available calls.  See the include
48       file for more.
49
50

EXAMPLES

52       Here's some sample code that runs an iperf client:
53           struct iperf_test *test;
54           test = iperf_new_test();
55           if ( test == NULL ) {
56               fprintf( stderr, "%s: failed to create test0, argv0 );
57               exit( EXIT_FAILURE );
58           }
59           iperf_defaults( test );
60           iperf_set_test_role( test, 'c' );
61           iperf_set_test_server_hostname( test, host );
62           iperf_set_test_server_port( test, port );
63           if ( iperf_run_client( test ) < 0 ) {
64               fprintf( stderr, "%s: error - %s0, argv0, iperf_strerror( i_errno ) );
65               exit( EXIT_FAILURE );
66           }
67           iperf_free_test( test );
68       And here's a server:
69           struct iperf_test *test;
70           test = iperf_new_test();
71           if ( test == NULL ) {
72               fprintf( stderr, "%s: failed to create test0, argv0 );
73               exit( EXIT_FAILURE );
74           }
75           iperf_defaults( test );
76           iperf_set_test_role( test, 's' );
77           iperf_set_test_server_port( test, port );
78           for (;;) {
79               if ( iperf_run_server( test ) < 0 )
80                   fprintf( stderr, "%s: error - %s0, argv0, iperf_strerror( i_errn
81       o ) );
82               iperf_reset_test( test );
83           }
84           iperf_free_test( test );
85       These are not complete programs,  just  excerpts.   The  full  runnable
86       source  code  can  be  found in the examples subdirectory of the iperf3
87       source tree.
88
89

AUTHORS

91       A list of the contributors to iperf3 can be found within the documenta‐
92       tion located at http://software.es.net/iperf/dev.html#authors.
93
94

SEE ALSO

96       iperf3(1), http://software.es.net/iperf/
97
98
99
100ESnet                           September 2015                     LIBIPERF(3)
Impressum