2.16.39. file_gethost

[<<<] [>>>]

@c Get host by name or by address

This function gets the struct hostent entry for the given address. The address can be given as a FQDN or as an IP octet tuple, like www.digital.com or 16.193.48.55

Optionally the address may contain a port number separated by : from the name or the IP number. The port number is simply ignored.

int file_gethost(char *pszBuffer,
                 struct hostent *pHost
  ){
pszBuffer should hold the name or the address of the target machine. This buffer is not altered during the function.

pHost should point to a buffer ready to hold the hostent information.

Note that the structure hostent contains pointers outside the structre. Those pointers are copied verbatim thus they point to the original content as returned by the underlying socket layer. This means that the values the hostent structure points to should not be freed, altered and the values needed later should be copied as soon as possible into a safe location before any other socket call is done.


[<<<] [>>>]