getnetbyname

Searches the network database sequentially from the beginning of the database for a network record with a given name or alias.

Format

#include  <netdb.h>

struct netent *getnetbyname  (char *name);

Argument

name
A pointer to a null-terminated character string of the name or an alias of the network sought.

Description

This routine finds the first host in the network database with the given name or alias.

The getnetent, getnetbyaddr, and getnetbyname routines all use a common static area for their return values. This means that subsequent calls to any of these routines will overwrite any existing network entry. You must make a copy of the network entry if you wish to save it.

Return Values
NULL  Indicates EOF or an error; errno is set to EFAULT (The buffer described by name is not a valid, writable part of the user address space.) 
A pointer to an object having the netent structure. See the <netdb.h> header file for a description of the netent structure.

Depending on the error condition and the socket implementation selected, errno or h_errno might be set to further indicate the error. (See sections A.5 and A.6.)  


Previous Page | Next Page | Table of Contents | Index