getprotobyname

The Windows Sockets getprotobyname function gets protocol information corresponding to a protocol name.

struct protoent FAR * getprotobyname (

const char FAR * name

);

Parameters

name

[in] A pointer to a null terminated protocol 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. All strings are null terminated.

struct protoent {

char FAR * p_name;

char FAR * FAR * p_aliases;

short p_proto;

};

The members of this structure are:

Element
Usage
p_name
Official name of the protocol.
p_aliases
A NULL-terminated array of alternate names.
p_proto
The protocol number, in host byte order.

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 function calls.

Return Values

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 can be retrieved by calling WSAGetLastError.

Error Codes

WSANOTINITIALISED
A successful WSAStartup must occur before using this function.
WSAENETDOWN
The network subsystem has failed.
WSAHOST_NOT_FOUND
Authoritative Answer Protocol not found.
WSATRY_AGAIN
Non-Authoritative Protocol not found, or server failure.
WSANO_RECOVERY
Nonrecoverable errors, the protocols database is not accessible.
WSANO_DATA
Valid name, no data record of requested type.
WSAEINPROGRESS
A blocking Windows Sockets 1.1 call is in progress, or the service provider is still processing a callback function.
WSAEFAULT
The name argument is not a valid part of the user address space.
WSAEINTR
The (blocking) call was canceled through WSACancelBlockingCall.

See Also

getprotobynumber
, WSAAsyncGetProtoByName

Software for developers
Delphi Components
.Net Components
Software for Android Developers
More information resources
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
Databases for Amazon shops developers
Amazon Categories Database
Browse Nodes Database