![]() Chapter Contents  | 
![]() Previous  | 
![]() Next  | 
| getprotobyname | 
| Portability: | UNIX compatible | 
| SYNOPSIS | |
| DESCRIPTION | |
| RETURN VALUE | |
| CAUTION | |
| PORTABILITY | |
| IMPLEMENTATION | |
| RELATED FUNCTIONS | 
| SYNOPSIS | 
#include <netdb.h> struct protoent *getprotobyname(char *name);
| DESCRIPTION | 
Given the null-terminated name of a protocol, 
getprotobyname
 returns a pointer
to the 
protoent
 structure
defined in 
<netdb.h>
.
This structure is typically used to obtain the number for the protocol from
the 
p_proto
 field. Refer
to <netdb.h> for details on the 
protoent
structure.  The source of the data in this structure is the protocols file,
that is, a file with the same format as the 
/etc/protocols
 file on a UNIX operating system. Refer to Search Logic for information on the logic
used to determine the location of the protocols file.
| RETURN VALUE | 
If 
getprotobyname
 succeeds, it returns a pointer to the 
protoent
 structure. A null pointer indicates
the network address was not found in the network file.
| CAUTION | 
The value that 
getprotobyname
 returns points to a static structure within the library.
 You must copy the information from this structure before you make further 
getprotobyname
, 
getprotobynumber
, or 
getprotoent
 calls.
| PORTABILITY | 
getprotobyname
 is portable to other environments, including most UNIX
systems, that implement BSD sockets.
| IMPLEMENTATION | 
getprotobyname
 is ported directly from the BSD UNIX Socket Library.
| RELATED FUNCTIONS | 
endprotoent
, 
setprotoent
, 
getprotobynumber
, 
getprotoent
![]() Chapter Contents  | 
![]() Previous  | 
![]() Next  | 
![]() Top of Page  | 
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.