Chapter Contents |
Previous |
Next |
getprotobynumber |
Portability: | UNIX compatible |
SYNOPSIS | |
DESCRIPTION | |
RETURN VALUE | |
CAUTION | |
PORTABILITY | |
IMPLEMENTATION | |
RELATED FUNCTIONS |
SYNOPSIS |
#include <netdb.h> struct protoent *getprotobynumber(int proto);
DESCRIPTION |
Given the number of a protocol, specified
by
proto
,
getprotobynumber
returns a pointer to the
protoent
structure defined in
<netdb.h>
for the specified
network protocol
proto
.
Refer to <netdb.h> for details on the
protoent
structure. This structure is typically used to obtain the name of the protocol
from the
p_name
field.
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
getprotobynumber
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
getprotobynumber
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 |
getprotobynumber
is portable to other environments, including most
UNIX systems, that implement BSD sockets.
IMPLEMENTATION |
getprotobynumber
is ported directly from the BSD UNIX Socket Library.
RELATED FUNCTIONS |
endprotoent
,
setprotoent
,
getprotobyname
,
getprotoent
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.