File:  [ELWIX - Embedded LightWeight unIX -] / libaitio / example / Attic / test_n2.c
Revision 1.2: download - view: text, annotated - select for diffs - revision graph
Tue Dec 13 02:23:07 2011 UTC (12 years, 6 months ago) by misho
Branches: MAIN
CVS tags: io2_5, io2_4, io2_3, IO2_4, IO2_3, IO2_2, HEAD
Release version 2.2

#include <stdio.h>
#include <aitio.h>


int
main(int argc, char **argv)
{
	io_sockaddr_t addr = { 0 };
	ait_val_t v;

	if (!io_gethostbyname(argv[1], 1234, &addr)) {
		printf("Error:: #%d - %s\n", io_GetErrno(), io_GetError());
		return 1;
	}

	if (!io_n2addr(&addr, &v)) {
		printf("Error:: #%d - %s\n", io_GetErrno(), io_GetError());
		return 2;
	}

	printf("Address is %s port is %u\n", AIT_GET_STR(&v), io_n2port(&addr));

	AIT_FREE_VAL(&v);
	return 0;
}

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>