Chapter Contents

Previous

Next
getnetbyname

getnetbyname



Gets Network Information by Name

Portability: UNIX compatible


SYNOPSIS
DESCRIPTION
RETURN VALUE
CAUTION
PORTABILITY
IMPLEMENTATION
RELATED FUNCTIONS


SYNOPSIS

#include <netdb.h>

struct netent *getnetbyname(const char *name);


DESCRIPTION

Given a network name, pointed to by the name argument, getnetbyname returns a pointer to the netent structure, as defined in <netdb.h> . Refer to <netdb.h> for details on the netent structure. This structure is typically used to obtain the network address from the n_net field. The source of the data in this 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 getnetbyname 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 getnetbyname 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

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


IMPLEMENTATION

getnetbyname is ported directly from the BSD UNIX Socket Library.


RELATED FUNCTIONS

getnetbyaddr , getnetent , setnetent , endnetent


Chapter Contents

Previous

Next

Top of Page

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