Skip to content

Latest commit

 

History

History
56 lines (40 loc) · 1.93 KB

gethostbyname.md

File metadata and controls

56 lines (40 loc) · 1.93 KB

Home

Function name : gethostbyname

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


The gethostbyname function retrieves host information corresponding to a host name from a host database.


Code examples:

How to build UDP responder
Winsock: retrieving the standard host name and IP address for the local machine
Winsock: retrieving information from a host database for a given host name
Winsock: retrieving Web pages using sockets (HTTP, port 80)
Winsock: sending email messages (SMTP, port 25)
Winsock: retrieving directory listing from an FTP server using passive data connection (FTP, port 21)
Winsock: reading email messages (POP3, port 110)
Winsock: connecting to a news server (NNTP, port 119)
How to create non-blocking Winsock server
How to ping a remote site using ICMP API calls

Declaration:

struct hostent FAR *gethostbyname(
  const char FAR *name
);  

FoxPro declaration:

DECLARE INTEGER gethostbyname IN ws2_32;
	STRING hostname  

Parameters:

name [in] Pointer to the null-terminated name of the host to resolve.


Return value:

If no error occurs, gethostbyname returns a pointer to the hostent structure described above. Otherwise, it returns a NULL pointer and a specific error number can be retrieved by calling WSAGetLastError.


Comments:

The gethostbyname function has been deprecated by the introduction of the getaddrinfo function.