![]() |
Nilorea Library
C utilities for networking, threading, graphics
|
#include <stdio.h>#include <stdlib.h>#include <string.h>#include <errno.h>#include <getopt.h>#include "nilorea/n_common.h"#include "nilorea/n_log.h"#include "nilorea/n_network.h"#include "nilorea/n_clock_sync.h"
Include dependency graph for ex_clock_sync.c:Go to the source code of this file.
Macros | |
| #define | MODE_CLIENT 1 |
| #define | MODE_SERVER 0 |
| #define | MSG_RESP "RESP" |
| sync response message: "RESP client_send_time server_time\n" | |
| #define | MSG_SYNC "SYNC" |
| sync request message: "SYNC client_send_time\n" | |
Functions | |
| static double | get_time (void) |
| int | main (int argc, char *argv[]) |
| static void | run_client (char *server, char *port, int nb_rounds) |
| static void | run_server (char *port, double fake_offset, int nb_rounds) |
| static void | usage (const char *prog) |
| #define MODE_CLIENT 1 |
Definition at line 53 of file ex_clock_sync.c.
| #define MODE_SERVER 0 |
Definition at line 52 of file ex_clock_sync.c.
| #define MSG_RESP "RESP" |
sync response message: "RESP client_send_time server_time\n"
Definition at line 58 of file ex_clock_sync.c.
| #define MSG_SYNC "SYNC" |
sync request message: "SYNC client_send_time\n"
Definition at line 56 of file ex_clock_sync.c.
|
static |
Definition at line 76 of file ex_clock_sync.c.
Referenced by run_client(), and run_server().
Here is the caller graph for this function:| int main | ( | int | argc, |
| char * | argv[] | ||
| ) |
Definition at line 230 of file ex_clock_sync.c.
References FreeNoLog, getoptret, LOG_DEBUG, LOG_ERR, LOG_INFO, log_level, LOG_NOTICE, mode, MODE_CLIENT, MODE_SERVER, port, run_client(), run_server(), server, set_log_level(), and usage().
Here is the call graph for this function:
|
static |
Definition at line 134 of file ex_clock_sync.c.
References N_CLOCK_SYNC::estimated_offset, N_CLOCK_SYNC::estimated_rtt, get_time(), LOG_ERR, LOG_NOTICE, MSG_RESP, MSG_SYNC, n_clock_sync_delete(), n_clock_sync_mark_sent(), n_clock_sync_new(), n_clock_sync_process_response(), n_clock_sync_server_time(), n_clock_sync_should_send(), n_log, netw, netw_close(), netw_connect_udp(), NETWORK_IPALL, port, recv_udp_data(), send_udp_data(), server, and u_sleep().
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 82 of file ex_clock_sync.c.
References get_time(), LOG_DEBUG, LOG_ERR, LOG_NOTICE, MSG_RESP, MSG_SYNC, n_log, netw, netw_bind_udp(), netw_close(), netw_udp_recvfrom(), netw_udp_sendto(), NETWORK_IPALL, and port.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 60 of file ex_clock_sync.c.