diff options
Diffstat (limited to '')
-rw-r--r-- | libraries/ecore/src/examples/ecore_con_lookup_example.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/libraries/ecore/src/examples/ecore_con_lookup_example.c b/libraries/ecore/src/examples/ecore_con_lookup_example.c new file mode 100644 index 0000000..3a3d024 --- /dev/null +++ b/libraries/ecore/src/examples/ecore_con_lookup_example.c | |||
@@ -0,0 +1,38 @@ | |||
1 | #include <stdio.h> | ||
2 | #include <Ecore.h> | ||
3 | #include <Ecore_Con.h> | ||
4 | |||
5 | static void | ||
6 | _lookup_done_cb(const char *canonname, const char *ip, struct sockaddr *addr, int addrlen, void *data) | ||
7 | { | ||
8 | printf("canonname = %s\n", canonname); | ||
9 | printf("ip = %s\n", ip); | ||
10 | printf("addr = %p\n", addr); | ||
11 | printf("addrlen = %d\n", addrlen); | ||
12 | } | ||
13 | |||
14 | int main(int argc, const char *argv[]) | ||
15 | { | ||
16 | if (argc < 2) | ||
17 | { | ||
18 | printf("need one parameter: <address>\n"); | ||
19 | return -1; | ||
20 | } | ||
21 | |||
22 | ecore_init(); | ||
23 | ecore_con_init(); | ||
24 | |||
25 | if (!ecore_con_lookup(argv[1], _lookup_done_cb, NULL)) | ||
26 | { | ||
27 | printf("error when trying to start lookup for %s\n", argv[1]); | ||
28 | goto end; | ||
29 | } | ||
30 | |||
31 | ecore_main_loop_begin(); | ||
32 | |||
33 | end: | ||
34 | ecore_con_shutdown(); | ||
35 | ecore_shutdown(); | ||
36 | |||
37 | return 0; | ||
38 | } | ||