| iMatix home page
| << | < | > | >>
SFL Logo SFL
Version 2.11

 

get_hostaddr

#include "sflsock.h"
qbyte
get_hostaddr (void)

Synopsis

Returns the current the host address as a 4-byte value in host format (not network format). Returns 0x7f000001 (loopback) if sockets are not supported or there was an error getting the current host IP address. If there are several IP addresses on the system, returns one arbitrary address.

Source Code - (sflsock.c)

{
#if (defined (DOES_SOCKETS))
    struct hostent
        *phe;                           /*  Host information entry           */

    phe = gethostbyname (get hostname ());
    if (phe)
        return (*(qbyte *) (phe-> h_addr_list [0]));
    else
        return (htonl (SOCKET_LOOPBACK));
#else
    return (htonl (SOCKET_LOOPBACK));
#endif
}

| << | < | > | >> iMatix Copyright © 1996-2000 iMatix Corporation