tv.tv_sec = TIMEOUT;
tv.tv_usec = 0;
- data = server (argv[1], &tv, handle_data);
+ data = udp_server (argv[1], &tv, handle_data);
- for (i = 0, n = poll (data); n == 0 && i < 3; n = poll (data), i++)
+ for (i = 0, n = udp_poll (data); n == 0 && i < 3; n = udp_poll (data), i++)
{
fprintf (stderr, "waiting another %ld second%s\n",
tv.tv_sec, tv.tv_sec > 1 ? "s" : "");
}
ssize_t
-poll (struct polldata *data)
+udp_poll (struct polldata *data)
{
int r;
long timeout;
}
struct polldata *
-server (const char *bindto, struct timeval *timeout, data_cb cb)
+udp_server (const char *bindto, struct timeval *timeout, data_cb cb)
{
struct addrinfo *res;
int s = -1;
#include <stdint.h>
#include <unistd.h>
#include <sys/time.h>
-//#include <sys/types.h>
typedef ssize_t (*data_cb) (const uint8_t *buf, ssize_t len);
struct polldata {
struct timeval *timeout;
};
-struct polldata *server (const char *bindto, struct timeval *timeout, data_cb cb);
-ssize_t poll (struct polldata *data);
+struct polldata *udp_server (const char *bindto, struct timeval *timeout, data_cb cb);
+ssize_t udp_poll (struct polldata *data);