\hypertarget{ecore_con_lookup_example_8c-example}{\section{ecore\+\_\+con\+\_\+lookup\+\_\+example.\+c}
}
Shows how to make a simple D\+N\+S lookup. See the complete example description at \hyperlink{ecore_con_lookup_example_c}{Ecore\+\_\+\+Con -\/ D\+N\+S lookup}


\begin{DoxyCodeInclude}
\textcolor{comment}{//Compile with:}
\textcolor{comment}{// gcc -o ecore\_con\_lookup\_example ecore\_con\_lookup\_example.c `pkg-config --libs --cflags ecore ecore-con`}

\textcolor{preprocessor}{#include <stdio.h>}
\textcolor{preprocessor}{#include <Ecore.h>}
\textcolor{preprocessor}{#include <Ecore\_Con.h>}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_lookup\_done\_cb(\textcolor{keyword}{const} \textcolor{keywordtype}{char} *canonname, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *ip, \textcolor{keyword}{struct} sockaddr *addr, \textcolor{keywordtype}{int} addrlen, \textcolor{keywordtype}{void} *data 
      \hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED})
\{
   printf(\textcolor{stringliteral}{"canonname = %s\(\backslash\)n"}, canonname);
   printf(\textcolor{stringliteral}{"ip = %s\(\backslash\)n"}, ip);
   printf(\textcolor{stringliteral}{"addr = %p\(\backslash\)n"}, addr);
   printf(\textcolor{stringliteral}{"addrlen = %d\(\backslash\)n"}, addrlen);
\}

\textcolor{keywordtype}{int}
main(\textcolor{keywordtype}{int} argc, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *argv[])
\{
   \textcolor{keywordflow}{if} (argc < 2)
     \{
        printf(\textcolor{stringliteral}{"need one parameter: <address>\(\backslash\)n"});
        \textcolor{keywordflow}{return} -1;
     \}

   \hyperlink{group__Ecore__Init__Group_ga77757609684a2c922dc5ec398274751b}{ecore\_init}();
   \hyperlink{group__Ecore__Con__Events__Group_gacf5ecf42c516bb9c8b6759721e9559bd}{ecore\_con\_init}();

   \textcolor{keywordflow}{if} (!ecore\_con\_lookup(argv[1], \_lookup\_done\_cb, NULL))
     \{
        printf(\textcolor{stringliteral}{"error when trying to start lookup for %s\(\backslash\)n"}, argv[1]);
        \textcolor{keywordflow}{goto} end;
     \}

   \hyperlink{group__Ecore__Main__Loop__Group_gaf103b9f668bb3e4fed12e52c6180132d}{ecore\_main\_loop\_begin}();

end:
   \hyperlink{group__Ecore__Con__Events__Group_gaccfd8dd2a1187b71339b5cc39dc83938}{ecore\_con\_shutdown}();
   \hyperlink{group__Ecore__Init__Group_ga768298b932f18d7e7593a447493e5cde}{ecore\_shutdown}();

   \textcolor{keywordflow}{return} 0;
\}

\end{DoxyCodeInclude}
 