Table of Contents


thrulay_get_setup - get setup information of a test stream.


#include <thrulay.h>

int thrulay_get_setup(int tid, int sid, void * setup);


thrulay_get_setup gets setup information of a TCP or UDP stream in a particular test. tid specifies a test and sid specifies a stream in a test. If the test was registered as a TCP test, setup should be a pointer to the thrulay_setup_tcp_t structure:

typedef struct _thrulay_setup_tcp {
    int fd_tcp; /* Socket fd of TCP connection. */
    int window_size_local; /* Local TCP window size. */
    int window_size_remote; /* Server side TCP window size. */
    int block_size; /* Negotiated TCP block size. */
    int mtu; /* Path MTU of the current socket. */
    int mss; /* Maximum segment size for outgoing TCP packets. */
} thrulay_setup_tcp_t;

If the test was registered as an UDP test, setup should be a pointer to the thrulay_setup_udp_t structure:

typedef struct _thrulay_setup_udp {
    int fd_tcp; /* Socket fd of the TCP channel.*/
    int fd_udp; /* Socket fd of the UDP channel.*/
    int port_udp_server; /* Server side UDP port number. */
    int packet_size; /* Negotiated UDP pacet size, in bytes. */
    double ps; /* Sending rate of pacekts per second. */
    u_int64_t npackets; /* Negotiated number of packet to send. */
    char nonce[8]; /* Passport for packets to be accepted. */
} thrulay_setup_udp_t;

Return Values

Return 0 on success. Otherwise, an error code is returned.


Get MSS of a TCP test stream.

int tid, mss, rc;
thrulay_setting_tcp_t setting_tcp;
thrulay_setup_tcp_t setup_tcp;

setting_tcp.server_name = "";
setting_tcp.port = 5003;
setting_tcp.test_duration = 5;
setting_tcp.report_interval = 1;
setting_tcp.nstream = 3;
tid = thrulay_open(THRULAY_TCP, &setting_tcp);
if (tid > 0) {
    rc = thrulay_get_setup(tid, &setup_tcp);
    if (rc == 0) mss = setup_tcp.mss;


Please send bug reports to <>.


Huadong Liu <>


See Also


Table of Contents