Standards / Extensions | C or C++ | Dependencies |
---|---|---|
XPG4.2 |
both |
#define _XOPEN_SOURCE_EXTENDED 1
#include <netdb.h>
struct netent *getnetbyaddr(ip_addr_t net, int type);
#define _POSIX_C_SOURCE 200112L
#include <netdb.h>
struct netent *getnetbyaddr(uint32_t net, int type);
#define _OE_SOCKETS
#include <sys/types.h>
#include <netdb.h>
struct netent *getnetbyaddr(unsigned long net, int type);
getnetbyaddr(), getnetbyname(), and getnetent() all use the same static area to return the netent structure. This static area is only valid until the next one of these functions is called on the same thread.
Special behavior for C++: To use this function with C++, you must use the _XOPEN_SOURCE_EXTENDED 1 feature test macro.
If successful, getnetbyaddr() returns a pointer to a netent structure. The return value points to data that is overwritten by subsequent calls returning the same data structure.
If unsuccessful, getnetbyaddr() returns a NULL pointer, indicating an error or End Of File (EOF).