/* Copyright (c) 2001-2009 by SoftIntegration, Inc. All Rights Reserved */
/* a sample program that prints the name of network. */
#include <stdlib.h>
#include <stdio.h>
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>

int main() {
    struct netent result;
    long int net = 10;
    char buffer[128];
    
    getnetbyaddr_r(net,AF_INET,&result,buffer,128);
    printf("%s\n",result.n_name); /* net name */
    printf("%d\n",result.n_net);  /* net number */
    printf("%s\n",result.n_aliases[0]); /* net aliases */
    printf("%d\n",result.n_addrtype); /* the type of network number */
}
 