ggeettpprroottoobbyynnaammee() -- Sockets Function (libsocket)

Get protocol entry by protocol name
#iinncclluuddee <nneettddbb.hh>
ssttrruucctt pprroottooeenntt *ggeettpprroottoobbyynnaammee(_n_a_m_e);
cchhaarr *_n_a_m_e;

ggeettpprroottoobbyynnaammee()  searches  file  /eettcc/pprroottooccoollss, which  holds  information
about  all protocols  recognized by  your local  network, for  the protocol
named  _n_a_m_e.  /eettcc/pprroottooccoollss  has  to   have  been  opened  by  a  call  to
sseettpprroottooeenntt().

ggeettpprroottoobbyynnaammee() returns a pointer to  an object of type pprroottooeenntt, which is
defined in header file nneettddbb.hh:

struct protoent {
    char *p_name;   /* official name of protocol */
    char **p_aliases;   /* alias list */
    int p_proto;    /* protocol number */
};

The following details each member:

pp_nnaammee
     The official name of the protocol.

pp_aalliiaasseess
     This  points to  a  zero-terminated list  of alternate  names for  the
     protocol.

pp_pprroottoo
     The number of the protocol.

ggeettpprroottoobbyynnaammee() returns  NULL if an error occurs, or  if it encounters the
end of the file.

_S_e_e _A_l_s_o
eennddpprroottooeenntt(),   ggeettpprroottoobbyynnuummbbeerr(),  ggeettpprroottooeenntt(),   lliibbssoocckkeett,  nneettddbb.hh,
sseettpprroottooeenntt()

_N_o_t_e_s
This function uses a static data  space.  If your application needs to save
these data, it must copy them before any subsequent calls overwrite them.

At present, only the Internet protocols are understood.
