gethostname

Returns the name currently associated to the host.

Format

#include  <socket.h>

int gethostname  (char *name, int namelen);

Arguments

name
The address of a buffer into which the name should be written. The returned name is null-terminated unless sufficient space is not provided.
namelen
The size of the buffer pointed to by name.

Description

This routine returns the hostname maintained by the DEC TCP/IP Services for OpenVMS or compatible TCP/IP product.

Return Values
Indicates success. 
-1  Indicates an error; errno is set to one of the following:

  • EFAULT - The buffer decribed by name and namelen is not a valid, writable part of the user address space.

  • EINVAL - The returned name is an invalid address.
 


Previous Page | Next Page | Table of Contents | Index