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

    1: #include <stdio.h>
    2: #include <aitio.h>
    3: 
    4: 
    5: int
    6: main(int argc, char **argv)
    7: {
    8: 	io_sockaddr_t addr = { 0 };
    9: 	ait_val_t v;
   10: 
   11: 	if (!io_gethostbyname(argv[1], 1234, &addr)) {
   12: 		printf("Error:: #%d - %s\n", io_GetErrno(), io_GetError());
   13: 		return 1;
   14: 	}
   15: 
   16: 	if (!io_n2addr(&addr, &v)) {
   17: 		printf("Error:: #%d - %s\n", io_GetErrno(), io_GetError());
   18: 		return 2;
   19: 	}
   20: 
   21: 	printf("Address is %s port is %u\n", AIT_GET_STR(&v), io_n2port(&addr));
   22: 
   23: 	AIT_FREE_VAL(&v);
   24: 	return 0;
   25: }

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