Skip to content

Latest commit

 

History

History
49 lines (35 loc) · 1.21 KB

gethostname.md

File metadata and controls

49 lines (35 loc) · 1.21 KB

Home

Function name : gethostname

Group: Windows Sockets 2 (Winsock) - Library: ws2_32


The gethostname function retrieves the standard host name for the local computer.


Code examples:

How to build UDP responder
Winsock: retrieving the standard host name and IP address for the local machine
Retrieving the IP-to-physical address mapping table
How to create non-blocking Winsock server

Declaration:

int gethostname(
  char FAR *name,
  int namelen
);  

FoxPro declaration:

DECLARE INTEGER gethostname IN ws2_32;
	STRING  @ name,;
	INTEGER   namelen  

Parameters:

name [out] Pointer to a buffer that receives the local host name.

namelen [in] Length of the buffer.


Return value:

If no error occurs, gethostname returns zero. Otherwise, it returns SOCKET_ERROR (-1) and a specific error code can be retrieved by calling WSAGetLastError.