2013-02-08 09:35:17 -08:00
|
|
|
//Compile with:
|
|
|
|
// gcc -o ecore_con_lookup_example ecore_con_lookup_example.c `pkg-config --libs --cflags ecore ecore-con`
|
|
|
|
|
2012-12-03 11:36:16 -08:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <Ecore.h>
|
|
|
|
#include <Ecore_Con.h>
|
|
|
|
|
|
|
|
static void
|
2015-07-23 08:18:04 -07:00
|
|
|
_lookup_done_cb(const char *canonname, const char *ip, struct sockaddr *addr, int addrlen EINA_UNUSED, void *data EINA_UNUSED)
|
2012-12-03 11:36:16 -08:00
|
|
|
{
|
|
|
|
printf("canonname = %s\n", canonname);
|
|
|
|
printf("ip = %s\n", ip);
|
|
|
|
printf("addr = %p\n", addr);
|
2015-04-22 03:41:43 -07:00
|
|
|
ecore_main_loop_quit();
|
2012-12-03 11:36:16 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
main(int argc, const char *argv[])
|
|
|
|
{
|
|
|
|
if (argc < 2)
|
|
|
|
{
|
|
|
|
printf("need one parameter: <address>\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
ecore_con_init();
|
|
|
|
|
|
|
|
if (!ecore_con_lookup(argv[1], _lookup_done_cb, NULL))
|
|
|
|
{
|
|
|
|
printf("error when trying to start lookup for %s\n", argv[1]);
|
|
|
|
goto end;
|
|
|
|
}
|
|
|
|
|
|
|
|
ecore_main_loop_begin();
|
|
|
|
|
|
|
|
end:
|
|
|
|
ecore_con_shutdown();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|