Annotation of libaitio/example/test_n2.c, revision 1.2.6.1
1.2 misho 1: #include <stdio.h>
1.2.6.1 ! misho 2: #include <string.h>
1.2 misho 3: #include <aitio.h>
4:
5:
6: int
7: main(int argc, char **argv)
8: {
9: io_sockaddr_t addr = { 0 };
1.2.6.1 ! misho 10: ait_val_t v, *val = NULL;
! 11:
! 12: AIT_SET_DATA(val, "shits hit the fan! --- shits with Merudia ...\n", 47);
! 13: printf("GET DATA = %p %s t=%d l=%d\n", val, AIT_GET_DATA(val), AIT_TYPE(val), AIT_LEN(val));
! 14: AIT_FREE_VAL(val);
1.2 misho 15:
16: if (!io_gethostbyname(argv[1], 1234, &addr)) {
17: printf("Error:: #%d - %s\n", io_GetErrno(), io_GetError());
18: return 1;
19: }
20:
21: if (!io_n2addr(&addr, &v)) {
22: printf("Error:: #%d - %s\n", io_GetErrno(), io_GetError());
23: return 2;
24: }
25:
26: printf("Address is %s port is %u\n", AIT_GET_STR(&v), io_n2port(&addr));
27:
28: AIT_FREE_VAL(&v);
29: return 0;
30: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>