getservbyport
The Windows Sockets
getservbyport function gets service information corresponding to a port and protocol.
struct servent FAR * getservbyport (
int port,
|
|
const char FAR* proto
|
|
);
|
|
Parameters
port
[in] The port for a service, in network byte order.
proto
[in] An optional pointer to a protocol name. If this is NULL,
getservbyport returns the first service entry for which the
port matches the s_port. Otherwise,
getservbyport matches both the
port and the
proto.
Remarks
getservbyport returns a pointer to a servent structure as described above for
getservbyname.
The pointer which is returned points to a structure which is allocated by
Windows Sockets. 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,
getservbyport returns a pointer to the servent 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 Service not found.
|
WSATRY_AGAIN
| Non-Authoritative Service not found, or server failure.
|
WSANO_RECOVERY
| Nonrecoverable errors, the services 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 proto argument is not a valid part of the user address space.
|
WSAEINTR
| The (blocking) call was canceled through WSACancelBlockingCall.
|
See Also
getservbyname,
WSAAsyncGetServByPort
- 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