WSAHtons (Windows CE 5.0)

Send Feedback

This function converts a u_short from host byte order to network byte order.

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 Values

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

The following table shows the possible error codes.

Error code Description
WSANOTINITIALISED A successful WSAStartup call must occur before using this function.
WSAENETDOWN The network subsystem has failed.
WSAENOTSOCK The descriptor is not a socket.
WSAEFAULT The lpnetshort parameter 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 lpnetshort parameter in the network byte order associated with socket s.

Requirements

OS Versions: Windows CE .NET 4.0 and later.
Header: Winsock2.h.
Link Library: Ws2.lib.

See Also

htonl | htons | ntohl | ntohs | WSAHtonl | WSANtohl | WSANtohs | WSAGetLastError | WSAStartup

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.