Share via


WSANtohl

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

int WSANtohl(
  SOCKET s,
  u_long netlong,
  u_long FAR* lphostlong
);

Parameters

  • s
    [in] Descriptor identifying a socket.
  • netlong
    [in] 32-bit number in network byte order.
  • lphostlong
    [out] Pointer to a 32-bit number in host 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 a list of 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 lphostlong parameter is not completely contained in a valid part of the user address space.

Remarks

This function takes a 32-bit number in the network byte order associated with socket s and returns a 32-bit number pointed to by the lphostlong parameter in host byte order.

Requirements

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

See Also

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

 Last updated on Saturday, April 10, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.