man atos () - convert a string to a sockaddr_in structure.

NAME

atos - convert a string to a sockaddr_in structure.

LIBRARIES

Abz Library (-labz), Debug Library (-ldebug)

SYNOPSIS

#include <abz/atos.h>

int atos(struct sockaddr_in *addr, const char *str);

DESCRIPTION

The atos() function converts a string to the standard struct sockaddr_in structure. The string should be in the following format:

<host-or-addr> [ : <service-or-port> ]

Both addresses and port numbers are stored network byte order.

RETURN VALUE

The atos() function returns 0 if successful or -1 if some error occurred. Check errno to see what error occurred.

NOTES

None of the libabz routines are thread-safe. I'm not planning to change this either! For more information, please see http://threading.2038bug.com/

If the library was compiled without the GETHOSTBYNAME flag, only ip-address may be specified, and if the library was compiled without the GETSERVBYNAME flag, only port numbers may be specified.

At the time of writing, the glibc library gethostbyname() function had a bug which caused it to resolve some invalid hostnames. In order to detect those cases, the atos() function also does a reverse lookup using gethostbyaddr() to see if the domain really exist.

AUTHOR

Written by Abraham vd Merwe <abz@blio.com>