Description
Get protocol information corresponding to a protocol name.
#include <winsock.h>
struct protoent FAR * PASCAL FAR getprotobyname ( const char FAR * name);
name
Remarks
getprotobyname() returns a pointer to the following structure which contains the name(s) and protocol number which correspond to the given protocol name.
struct protoent { char FAR * p_name; char FAR * FAR *p_aliases; short p_proto; };
The members of this structure are:
p_name
The pointer which is returned points to a structure which is allocated by the Windows Sockets library. The application must never attempt to modify this structure or to free any of its components. Furthermore only one copy of this structure is allocated per thread, and so the application should copy any information which it needs before issuing any other Windows Sockets API calls.
Return Value
If no error occurs, getprotobyname() returns a pointer to the protoent structure described above. Otherwise it returns a NULL pointer and a specific error number may be retrieved by calling WSAGetLastError().
Error Codes
WSANOTINITIALISED
See Also
WSAAsyncGetProtoByName(), getprotobynumber()