2018-07-17 06:46:02 +08:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "../testing/misc_tools.h"
|
|
|
|
#include "../toxcore/ccompat.h"
|
2018-02-06 00:11:49 +08:00
|
|
|
|
|
|
|
int main(void)
|
|
|
|
{
|
2018-02-19 01:50:50 +08:00
|
|
|
setvbuf(stdout, nullptr, _IONBF, 0);
|
|
|
|
Tox *tox1 = tox_new_log_lan(nullptr, nullptr, nullptr, /* lan_discovery */true);
|
|
|
|
Tox *tox2 = tox_new_log_lan(nullptr, nullptr, nullptr, /* lan_discovery */true);
|
2018-02-06 00:11:49 +08:00
|
|
|
|
2018-07-05 02:21:43 +08:00
|
|
|
printf("Waiting for LAN discovery. This loop will attempt to run until successful.");
|
2018-02-06 00:11:49 +08:00
|
|
|
|
2018-08-25 20:16:54 +08:00
|
|
|
do {
|
2018-02-06 00:11:49 +08:00
|
|
|
printf(".");
|
|
|
|
fflush(stdout);
|
|
|
|
|
|
|
|
tox_iterate(tox1, nullptr);
|
|
|
|
tox_iterate(tox2, nullptr);
|
|
|
|
c_sleep(1000);
|
2018-08-25 20:16:54 +08:00
|
|
|
} while (tox_self_get_connection_status(tox1) == TOX_CONNECTION_NONE ||
|
|
|
|
tox_self_get_connection_status(tox2) == TOX_CONNECTION_NONE);
|
2018-02-06 00:11:49 +08:00
|
|
|
|
|
|
|
printf(" %d <-> %d\n",
|
|
|
|
tox_self_get_connection_status(tox1),
|
|
|
|
tox_self_get_connection_status(tox2));
|
|
|
|
|
|
|
|
tox_kill(tox2);
|
|
|
|
tox_kill(tox1);
|
|
|
|
return 0;
|
|
|
|
}
|