Chapter Contents

Previous

Next
getnetbyaddr

getnetbyaddr



Gets Network Information by Address

Portability: UNIX compatible


SYNOPSIS
DESCRIPTION
RETURN VALUE
CAUTION
PORTABILITY
IMPLEMENTATION
RELATED FUNCTIONS


SYNOPSIS

#include <netdb.h>

struct netent *getnetbyaddr(long net, int type);


DESCRIPTION

Given a network address, specified by net , getnetbyaddr returns a pointer to the netent structure as defined in <netdb.h> . This structure typically is used to obtain the network name from the n_name field. The network address should be supplied in host byte order. For TCP/IP, type should be AF_INET . Refer to <netdb.h> for details on the netent structure. The source of the data in the netent structure is the network file, that is, a file with the same format as the /etc/networks file on a UNIX operating system.

Refer to Search Logic for information on the logic used to determine the location of the network file.


RETURN VALUE

If getnetbyaddr succeeds, it returns a pointer to the netent structure. A null pointer indicates the network address was not found in the network file.


CAUTION

The value that getnetbyaddr returns points to a static structure within the library. You must copy the information from this structure before you make further getnetbyname , getnetbyaddr , or getnetent calls.


PORTABILITY

getnetbyaddr is portable to other environments, including most UNIX systems, that implement BSD sockets.


IMPLEMENTATION

getnetbyaddr is ported directly from the BSD UNIX Socket Library.


RELATED FUNCTIONS

getnetent , getnetbyname , setnetent , endnetent


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.