Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
This function converts a u_shortfrom host byte order to network byte order.
Syntax
int WSAHtons( SOCKET s, u_short hostshort, u_short FAR* lpnetshort ); |
Parameters
- s
-
[in] Descriptor identifying a socket.
- hostshort
-
[in] 16-bit number in host byte order.
- lpnetshort
-
[out] Pointer to a 16-bit number in network byte order.
Return Value
If no error occurs, this function returns zero. If an error occurs, a value of SOCKET_ERROR is returned, and a specific error code can be retrieved by calling the WSAGetLastErrorfunction.
The following table shows the possible error codes.
Error code | Description |
---|---|
WSANOTINITIALISED |
A successful WSAStartupcall must occur before using this function. |
WSAENETDOWN |
The network subsystem has failed. |
WSAENOTSOCK |
The descriptor is not a socket. |
WSAEFAULT |
The lpnetshortparameter is not completely contained in a valid part of the user address space. |
Remarks
This function takes a 16-bit number in host byte order and returns a 16-bit number pointed to by the lpnetshortparameter in the network byte order associated with socket s.
Requirements
Header | winsock2.h |
Library | Ws2.lib |
Windows Embedded CE | Windows CE .NET 4.0 and later |
Windows Mobile | Windows Mobile Version 5.0 and later |