示例#1
0
static void send_stop_packet(discovery_service *svc) {
  void *buffer;
  size_t len = peerton(peerstore_get_local_peer(svc->peers), &buffer);
  jnx_uint8 *message = malloc(4 + len);
  memcpy(message, "STOP", 4);
  memcpy(message + 4, buffer, len);

  jnx_socket_udp_send(svc->sock_send, svc->broadcast_group_address, port_to_string(svc), message, len + 4);
#ifdef DEBUG
  debug_packet(svc, "STOP");
#endif
}
示例#2
0
static void *worker_ipv6(void *args) {
  char *port = (char*)args;
  jnx_socket *t = jnx_socket_udp_create(AF_INET6);
  jnx_socket_udp_send(t,"::1",port,(jnx_uint8*)"ping",5);
  return NULL;
}