void test_suite_setup() { tnt = tnt_net(NULL); fail_if(tnt == NULL); tnt_set(tnt, TNT_OPT_HOSTNAME, "localhost"); tnt_set(tnt, TNT_OPT_PORT, 33013); tnt_set(tnt, TNT_OPT_SEND_BUF, 128000); if (tnt_init(tnt) == -1) fail_tnt_perror("tnt_init"); if (tnt_connect(tnt) == -1) fail_tnt_perror("tnt_connect"); }
static void tc_connect(void) { /* allocating stream */ tc.net = tnt_net(NULL); if (tc.net == NULL) tc_error("stream allocation error"); /* initializing network stream */ tnt_set(tc.net, TNT_OPT_HOSTNAME, tc.opt.host); tnt_set(tc.net, TNT_OPT_PORT, tc.opt.port); tnt_set(tc.net, TNT_OPT_SEND_BUF, 0); tnt_set(tc.net, TNT_OPT_RECV_BUF, 0); if (tnt_init(tc.net) == -1) tc_error("%s", tnt_strerror(tc.net)); /* connecting to server */ if (tnt_connect(tc.net) == -1) tc_error("%s", tnt_strerror(tc.net)); }