\hypertarget{ecore_con_lookup_example_8c-example}{}\section{ecore\+\_\+con\+\_\+lookup\+\_\+example.\+c}
Shows how to make a simple D\+NS lookup. See the complete example description at \hyperlink{ecore_con_lookup_example_c}{Ecore\+\_\+\+Con -\/ D\+NS 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 
      \hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}, \textcolor{keywordtype}{void} *data 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);
   \hyperlink{group__Ecore__Main__Loop__Group_ga95cf8e97dff0716433c2c5474d606a98}{ecore\_main\_loop\_quit}();
\}

\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__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}();

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

\end{DoxyCodeInclude}
 