Returns the network id of the given Internet address.
Standard C Library (libc.a)
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <netinet/in.h>
#include <arpa/inet.h>
int inet_netof ( InternetAddr)
struct in_addr InternetAddr;
The inet_netof subroutine returns the network number from the specified Internet address number typed as unsigned long value. The inet_netof subroutine masks off the network number and the host number from the Internet address based on the Internet address class.
All applications containing the inet_netof subroutine must be compiled with the _BSD macro set to a specific value. Acceptable values are 43 and 44. In addition, all socket applications must include the BSD libbsd.a library.
Item | Description |
---|---|
InternetAddr | Specifies the Internet address to separate. |
Upon successful completion, the inet_netof subroutine returns a network number from the specified long value representing the Internet address. If the application gives a class A Internet address, the inet_lnoaf subroutine returns the logical product of the Internet address and 0xFF000000. If the application gives a class B Internet address, the inet_lnoaf subroutine returns the logical product of the Internet address and 0xFFFF0000. If the application does not give a class A or B Internet address, the inet_lnoaf subroutine returns the logical product of the Internet address and 0xFFFFFF00.
Item | Description |
---|---|
/etc/hosts | Contains host names. |
/etc/networks | Contains network names. |