2018-07-17 06:46:02 +08:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
2018-02-06 00:11:49 +08:00
|
|
|
#endif
|
|
|
|
|
2018-07-17 06:46:02 +08:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include "../testing/misc_tools.h"
|
|
|
|
#include "check_compat.h"
|
2018-02-06 00:11:49 +08:00
|
|
|
|
|
|
|
static uint8_t const key[] = {
|
2019-11-02 22:35:21 +08:00
|
|
|
0x02, 0x80, 0x7C, 0xF4, 0xF8, 0xBB, 0x8F, 0xB3,
|
|
|
|
0x90, 0xCC, 0x37, 0x94, 0xBD, 0xF1, 0xE8, 0x44,
|
|
|
|
0x9E, 0x9A, 0x83, 0x92, 0xC5, 0xD3, 0xF2, 0x20,
|
|
|
|
0x00, 0x19, 0xDA, 0x9F, 0x1E, 0x81, 0x2E, 0x46,
|
2018-02-06 00:11:49 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
int main(void)
|
|
|
|
{
|
2018-02-19 01:50:50 +08:00
|
|
|
setvbuf(stdout, nullptr, _IONBF, 0);
|
2018-02-06 00:11:49 +08:00
|
|
|
|
2018-02-19 01:50:50 +08:00
|
|
|
Tox *tox_udp = tox_new_log(nullptr, nullptr, nullptr);
|
|
|
|
|
2019-11-02 22:35:21 +08:00
|
|
|
tox_bootstrap(tox_udp, "78.46.73.141", 33445, key, nullptr);
|
2018-02-06 00:11:49 +08:00
|
|
|
|
|
|
|
printf("Waiting for connection");
|
|
|
|
|
2018-08-25 20:16:54 +08:00
|
|
|
do {
|
2018-02-06 00:11:49 +08:00
|
|
|
printf(".");
|
|
|
|
fflush(stdout);
|
|
|
|
|
2018-02-19 01:50:50 +08:00
|
|
|
tox_iterate(tox_udp, nullptr);
|
|
|
|
c_sleep(ITERATION_INTERVAL);
|
2018-08-25 20:16:54 +08:00
|
|
|
} while (tox_self_get_connection_status(tox_udp) == TOX_CONNECTION_NONE);
|
2018-02-06 00:11:49 +08:00
|
|
|
|
2018-10-09 05:05:14 +08:00
|
|
|
const Tox_Connection status = tox_self_get_connection_status(tox_udp);
|
2018-07-17 06:46:02 +08:00
|
|
|
ck_assert_msg(status == TOX_CONNECTION_UDP,
|
|
|
|
"expected connection status to be UDP, but got %d", status);
|
2018-02-19 01:50:50 +08:00
|
|
|
printf("Connection (UDP): %d\n", tox_self_get_connection_status(tox_udp));
|
2018-02-06 00:11:49 +08:00
|
|
|
|
2018-02-19 01:50:50 +08:00
|
|
|
tox_kill(tox_udp);
|
2018-02-06 00:11:49 +08:00
|
|
|
return 0;
|
|
|
|
}
|