gethostname Function

Microchip TCP/IP Stack

Microchip TCP/IP Stack Help
gethostname Function
C
int gethostname(
    char* name, 
    int namelen
);
Description

This function returns the standard host name of the system which is calling this function. The returned name is null-terminated.

Preconditions

None.

Parameters
Parameters 
Description 
name 
Pointer to a buffer that receives the local host name. 
namelen 
size of the name array. 
Returns

Success will return a value of 0. If name is too short to hold the host name or any other error occurs, SOCKET_ERROR (-1) will be returned. On error, *name will be unmodified and no null terminator will be generated.

Remarks

None.

Microchip TCP/IP Stack 5.42.08 - June 15, 2013
Copyright © 2012 Microchip Technology, Inc.  All rights reserved.