14 buf->len = suggested_size;
19 fprintf(stderr,
"Read error %s\n",
uv_err_name(nread));
25 char sender[17] = { 0 };
27 fprintf(stderr,
"Recv from %s\n", sender);
30 unsigned int *as_integer = (
unsigned int*)
buf->base;
31 unsigned int ipbin = ntohl(as_integer[4]);
32 unsigned char ip[4] = {0};
34 for (
i = 0;
i < 4;
i++)
35 ip[
i] = (ipbin >>
i*8) & 0xff;
36 fprintf(stderr,
"Offered IP %d.%d.%d.%d\n",
ip[3],
ip[2],
ip[1],
ip[0]);
static mcore_handle handle
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len static semflg const void static shmflg const struct timespec req
RZ_API void Ht_() free(HtName_(Ht) *ht)
return memset(p, 0, total)
int main(int argc, const char **argv)
void * malloc(size_t size)
static const char struct stat static buf struct stat static buf static vhangup int status
static struct sockaddr static addrlen static backlog const void static flags void flags
void on_read(uv_stream_t *client, ssize_t nread, const uv_buf_t *buf)
void alloc_buffer(uv_handle_t *handle, size_t suggested_size, uv_buf_t *buf)
void on_send(uv_udp_send_t *req, int status)
uv_buf_t make_discover_msg()
UV_EXTERN int uv_ip4_addr(const char *ip, int port, struct sockaddr_in *addr)
UV_EXTERN int uv_udp_bind(uv_udp_t *handle, const struct sockaddr *addr, unsigned int flags)
UV_EXTERN int uv_udp_recv_start(uv_udp_t *handle, uv_alloc_cb alloc_cb, uv_udp_recv_cb recv_cb)
UV_EXTERN int uv_udp_send(uv_udp_send_t *req, uv_udp_t *handle, const uv_buf_t bufs[], unsigned int nbufs, const struct sockaddr *addr, uv_udp_send_cb send_cb)
UV_EXTERN int uv_ip4_name(const struct sockaddr_in *src, char *dst, size_t size)
UV_EXTERN int uv_udp_recv_stop(uv_udp_t *handle)
UV_EXTERN int uv_run(uv_loop_t *, uv_run_mode mode)
UV_EXTERN const char * uv_err_name(int err)
UV_EXTERN int uv_udp_init(uv_loop_t *, uv_udp_t *handle)
UV_EXTERN void uv_close(uv_handle_t *handle, uv_close_cb close_cb)
UV_EXTERN const char * uv_strerror(int err)
UV_EXTERN uv_loop_t * uv_default_loop(void)
UV_EXTERN int uv_udp_set_broadcast(uv_udp_t *handle, int on)