getnetbyaddr()

The getnetbyaddr() call returns a pointer to the ETC\NETWORKS file entry that contains the specified network address.

Syntax

#include <netdb.h>
struct netent *getnetbyaddr(net, type)
u_long net;
int type;

Parameters

net

type

Description

The getnetbyaddr() call searches the ETC\NETWORKS file for the specified network address.

The getnetbyaddr() call retrieves information from the ETC\NETWORKS file using the network address as a search key. The getnetbyaddr() call searches the file sequentially from the start of the file until it encounters a matching net number and type or until it reaches the end of the file.

The getnetbyaddr() call returns a pointer to a netent structure, which contains the equivalent fields for a network description line in the ETC\NETWORKS file. The netent structure is defined in the <NETDB.H> file.

Use the endnetent() call to close the ETC\NETWORKS file.

Return Values

The return value points to static data that subsequent API calls can modify. A pointer to a netent structure indicates success. A NULL pointer indicates an error or EOF.

The netent structure is defined in the <NETDB.H> header file and contains the following elements:

Element

n _ name n _ aliases n _ addrtype n _ net

Related Calls


[Back: _getlong()]
[Next: getnetbyname()]