|
|
To obtain a particular protocol, select the protocol number
as defined within the communication domain.
For the Internet domain,
the available protocols are defined in
netinet/in.h.
You can also use one of the library
routines such as getprotobyname in
getprotoent(SLIB):
#include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> /* ... */ pp = getprotobyname("tcp"); s = socket(AF_INET, SOCK_STREAM, pp->p_proto);