File:
[ELWIX - Embedded LightWeight unIX -] /
libaitio /
example /
Attic /
test_n2.c
Revision
1.3:
download - view:
text,
annotated -
select for diffs -
revision graph
Thu Mar 29 01:31:33 2012 UTC (12 years, 5 months ago) by
misho
Branches:
MAIN
CVS tags:
io5_0,
io4_1,
io4_0,
io3_9,
io3_8,
io3_7,
io3_6,
io3_5,
io3_4,
io3_3,
io3_2,
io3_1,
io2_8,
io2_7,
io2_6,
IO4_1,
IO4_0,
IO3_9,
IO3_8,
IO3_7,
IO3_6,
IO3_5,
IO3_4,
IO3_3,
IO3_2,
IO3_1,
IO3_0,
IO2_7,
IO2_6,
IO2_5,
HEAD
version 2.5
1: #include <stdio.h>
2: #include <string.h>
3: #include <aitio.h>
4:
5:
6: int
7: main(int argc, char **argv)
8: {
9: io_sockaddr_t addr = { 0 };
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_SET_DATA(val, argv[1], strlen(argv[1]) + 1);
15: AIT_FREE_VAL(val);
16: AIT_SET_DATA(val, argv[1], strlen(argv[1]) + 1);
17: printf("GET DATA = %p %s t=%d l=%d\n", val, AIT_GET_DATA(val), AIT_TYPE(val), AIT_LEN(val));
18: AIT_FREE_VAL(val);
19: free(val);
20:
21: if (!io_gethostbyname(argv[1], 1234, &addr)) {
22: printf("Error:: #%d - %s\n", io_GetErrno(), io_GetError());
23: return 1;
24: }
25:
26: if (!io_n2addr(&addr, &v)) {
27: printf("Error:: #%d - %s\n", io_GetErrno(), io_GetError());
28: return 2;
29: }
30:
31: printf("Address is %s port is %u\n", AIT_GET_STR(&v), io_n2port(&addr));
32:
33: AIT_FREE_VAL(&v);
34: return 0;
35: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>