Share via


WSAHtonl (Windows Embedded CE 6.0)

1/6/2010

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

Syntax

int WSAHtonl(
  SOCKET s,
  u_long hostlong,
  u_long FAR* lpnetlong
);

Parameters

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

Remarks

This function takes a 32-bit number in host byte order and returns a 32-bit number pointed to by the lpnetlong parameter 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

See Also

Reference

htonl
htons
ntohl
ntohs
WSANtohl
WSAHtons
WSANtohs
WSAGetLastError
WSAStartup

Concepts

Windows-Specific Extension Functions