dht-example.c
static void
callback(void *closure,
         int event,
         const unsigned char *info_hash,
         const void *data, size_t data_len)
{
    if(event == DHT_EVENT_SEARCH_DONE)
        printf("Search done.\n");
    else if(event == DHT_EVENT_SEARCH_DONE6)
        printf("IPv6 search done.\n");
    else if(event == DHT_EVENT_VALUES)
        printf("Received %d values.\n", (int)(data_len / 6));
    else if(event == DHT_EVENT_VALUES6)
        printf("Received %d IPv6 values.\n", (int)(data_len / 18));
    else
        printf("Unknown DHT event %d.\n", event);
}
/* The call-back function is called by the DHT whenever something
   interesting happens.  Right now, it only happens when we get a new value or
   when a search completes, but this may be extended in future versions. */
The call-back function is called by the DHT whenever something
interesting happens.  Right now, it only happens when we get a new value or
when a search completes, but this may be extended in future versions.
The call - back function is called by the DHT whenever something interesting happens . Right now it only happens when we get a new value or when a search completes but this may be extended in future versions .
static void
callback(void *closure,
         int event,
         const unsigned char *info_hash,
         const void *data, size_t data_len)
{
    if(event == DHT_EVENT_SEARCH_DONE)
        printf("Search done.\n");
    else if(event == DHT_EVENT_SEARCH_DONE6)
        printf("IPv6 search done.\n");
    else if(event == DHT_EVENT_VALUES)
        printf("Received %d values.\n", (int)(data_len / 6));
    else if(event == DHT_EVENT_VALUES6)
        printf("Received %d IPv6 values.\n", (int)(data_len / 18));
    else
        printf("Unknown DHT event %d.\n", event);
}
static void callback ( void * closure , int event , const unsigned char * info_hash , const void * data , size_t data_len ) { if ( event == DHT_EVENT_SEARCH_DONE ) printf ( " \n " ) ; else if ( event == DHT_EVENT_SEARCH_DONE6 ) printf ( " \n " ) ; else if ( event == DHT_EVENT_VALUES ) printf ( " \n " , ( int ) ( data_len / 6 ) ) ; else if ( event == DHT_EVENT_VALUES6 ) printf ( " \n " , ( int ) ( data_len / 18 ) ) ; else printf ( " \n " , event ) ; }
The call-back function is called by the DHT whenever something
interesting happens.
The call - back function is called by the DHT whenever something interesting happens .