sethostname (Windows CE 5.0)

Send Feedback

This function is used to register the host name on a network with the Windows Internet Naming Service (WINS).

int sethostname(  char* pName,int cName);

Parameters

  • pName
    [in] Pointer to the host name.
  • cName
    [in] Length of the host name.

Return Values

If no error occurs, this function returns zero. If an error occurs, this function returns a value of SOCKET_ERROR, and retrieves a specific error code by calling WSAGetLastError.

The following table shows possible error codes for this function.

Error code Description
WSAEFAULT The name parameter is not a valid part of the user address space, or the buffer size specified by the cName parameter is too small to hold the complete host name.
WSAEINVAL One of the parameters is invalid.
WSAENETDOWN The network subsystem failed.
WSAEALREADY The host already is the name specified.

Requirements

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

See Also

WSAGetLastError

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.