\hypertarget{class_net_host}{}\doxysection{Net\+Host Class Reference}
\label{class_net_host}\index{NetHost@{NetHost}}


{\ttfamily \#include $<$host.\+hpp$>$}



Inheritance diagram for Net\+Host\+:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=310pt]{class_net_host__inherit__graph}
\end{center}
\end{figure}


Collaboration diagram for Net\+Host\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{class_net_host__coll__graph}
\end{center}
\end{figure}
\doxysubsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{class_net_host_a4a47787668685a313fbfa78f490d9e4b}{Net\+Host}} ()
\item 
\mbox{\hyperlink{class_net_host_a73406b69b099be8c93b5c63ef1c1e2be}{$\sim$\+Net\+Host}} ()
\item 
void \mbox{\hyperlink{class_net_host_a190ad3c2e89a9ce298b5cd2134911f70}{thread\+\_\+loop}} ()
\begin{DoxyCompactList}\small\item\em Host loop. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{class_net_host_a608e6eac768a93c0333c08a806d2f82a}{open}} (int port)
\begin{DoxyCompactList}\small\item\em Start server. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{class_net_host_a15c41b049b4e6f960887c200a487b539}{client\+\_\+ipport\+\_\+set}} (std\+::string ip, int port)
\begin{DoxyCompactList}\small\item\em Connect to server. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{class_net_host_aa822125801031e3d4c3a01bb8dfb7216}{connect\+\_\+to}} ()
\item 
\mbox{\hyperlink{class_net_remote}{Net\+Remote}} $\ast$ \mbox{\hyperlink{class_net_host_ae81503fb7c5f081274201bcb981a67a8}{get\+\_\+newremote}} ()
\begin{DoxyCompactList}\small\item\em Get last remote connection. \end{DoxyCompactList}\item 
int \mbox{\hyperlink{class_net_host_ad884cddae0c0449d590d7a957a566f18}{check}} ()
\begin{DoxyCompactList}\small\item\em Check incoming connections and in/out messages. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{class_net_host_a15a007c20889ad43452096db5d6a5bb0}{push\+\_\+message}} (int32\+\_\+t callback\+\_\+id, std\+::string str)
\item 
void \mbox{\hyperlink{class_net_host_a98639e6953680f5a7b95df321543de73}{send\+\_\+remote}} (\mbox{\hyperlink{class_net_message}{Net\+Message}} $\ast$msg)
\begin{DoxyCompactList}\small\item\em Push Net\+Messages to remotes (server or clients) \end{DoxyCompactList}\item 
void \mbox{\hyperlink{class_net_host_a54d02915aa7b2459ead1f62230c705e4}{check\+\_\+msg\+\_\+\+\_\+\+T\+O\+LD}} ()
\begin{DoxyCompactList}\small\item\em D\+E\+P\+R\+E\+C\+A\+T\+ED. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Protected Member Functions}
\begin{DoxyCompactItemize}
\item 
void \mbox{\hyperlink{class_net_host_a0f86d9fef85fb76f37637cf3b9187fbf}{close}} ()
\begin{DoxyCompactList}\small\item\em Close connection and socket. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Protected Attributes}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{class_s_o_j_o_t_z_1_1_callback_handler}{S\+O\+J\+O\+T\+Z\+::\+Callback\+Handler}} $\ast$ \mbox{\hyperlink{class_net_host_aa160b0d53ecf24363a489fcc73d72eef}{m\+\_\+cbhandler}}
\begin{DoxyCompactList}\small\item\em Call\+Back handler, allocated and init by \mbox{\hyperlink{class_server_app}{Server\+App}} or Client\+App. \end{DoxyCompactList}\item 
\mbox{\hyperlink{class_net_remote}{Net\+Remote}} $\ast$ \mbox{\hyperlink{class_net_host_aefe4e94b94fb403db5386af3c7e2b532}{m\+\_\+client}}
\item 
\mbox{\hyperlink{class_s_o_j_o_t_z_1_1_chat}{S\+O\+J\+O\+T\+Z\+::\+Chat}} $\ast$ \mbox{\hyperlink{class_net_host_adb5569a721e31670e4833c8748c0e5aa}{m\+\_\+chat}}
\end{DoxyCompactItemize}
\doxysubsection*{Private Member Functions}
\begin{DoxyCompactItemize}
\item 
void \mbox{\hyperlink{class_net_host_ae6c89d782e950ab20b24c8415639b898}{thread\+\_\+launch}} ()
\begin{DoxyCompactList}\small\item\em Thread launcher. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Private Attributes}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{sojotz_8hpp_a2cf3c22d8cacfe663a4eec13d0fb26ef}{M\+U\+T\+EX}} $\ast$ \mbox{\hyperlink{class_net_host_a8f096b083a96cea995f77d2ffb7a7047}{m\+\_\+mutex}}
\item 
\mbox{\hyperlink{class_net_t_c_p_server}{Net\+T\+C\+P\+Server}} $\ast$ \mbox{\hyperlink{class_net_host_a6f063d7a2b2ee6aa79971a08a70ba6c0}{m\+\_\+server}}
\item 
bool \mbox{\hyperlink{class_net_host_a0ff07f82fae36c36f73de82b8c455a14}{m\+\_\+server\+On}}
\item 
\mbox{\hyperlink{class_net_t_c_p_socket_set}{Net\+T\+C\+P\+Socket\+Set}} $\ast$ \mbox{\hyperlink{class_net_host_ac2bfed849a481a789e709ccd45a77093}{m\+\_\+tcpsocketset}}
\item 
\mbox{\hyperlink{class_s_o_j_o_t_z_1_1_s_queue}{S\+O\+J\+O\+T\+Z\+::\+S\+Queue}}$<$ \mbox{\hyperlink{class_s_o_j_o_t_z_1_1_ref_object}{S\+O\+J\+O\+T\+Z\+::\+Ref\+Object}} $>$ \mbox{\hyperlink{class_net_host_a3a03ba0dc66654174cf64cfdb2e6456b}{m\+\_\+newremotes}}
\item 
std\+::string \mbox{\hyperlink{class_net_host_a15112cf982c015062fc3725a7fad6a67}{m\+\_\+client\+\_\+ip}}
\item 
int \mbox{\hyperlink{class_net_host_add1302b7803a60fa9b3067bf7a46d309}{m\+\_\+client\+\_\+port}}
\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}


Definition at line 17 of file host.\+hpp.



\doxysubsection{Constructor \& Destructor Documentation}
\mbox{\Hypertarget{class_net_host_a4a47787668685a313fbfa78f490d9e4b}\label{class_net_host_a4a47787668685a313fbfa78f490d9e4b}} 
\index{NetHost@{NetHost}!NetHost@{NetHost}}
\index{NetHost@{NetHost}!NetHost@{NetHost}}
\doxysubsubsection{\texorpdfstring{NetHost()}{NetHost()}}
{\footnotesize\ttfamily Net\+Host\+::\+Net\+Host (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Definition at line 16 of file host.\+cpp.

\mbox{\Hypertarget{class_net_host_a73406b69b099be8c93b5c63ef1c1e2be}\label{class_net_host_a73406b69b099be8c93b5c63ef1c1e2be}} 
\index{NetHost@{NetHost}!````~NetHost@{$\sim$NetHost}}
\index{````~NetHost@{$\sim$NetHost}!NetHost@{NetHost}}
\doxysubsubsection{\texorpdfstring{$\sim$NetHost()}{~NetHost()}}
{\footnotesize\ttfamily Net\+Host\+::$\sim$\+Net\+Host (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Definition at line 27 of file host.\+cpp.



\doxysubsection{Member Function Documentation}
\mbox{\Hypertarget{class_net_host_ad884cddae0c0449d590d7a957a566f18}\label{class_net_host_ad884cddae0c0449d590d7a957a566f18}} 
\index{NetHost@{NetHost}!check@{check}}
\index{check@{check}!NetHost@{NetHost}}
\doxysubsubsection{\texorpdfstring{check()}{check()}}
{\footnotesize\ttfamily int Net\+Host\+::check (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Check incoming connections and in/out messages. 

\begin{DoxyReturn}{Returns}
0 if ok 
\end{DoxyReturn}


Definition at line 164 of file host.\+cpp.

\mbox{\Hypertarget{class_net_host_a54d02915aa7b2459ead1f62230c705e4}\label{class_net_host_a54d02915aa7b2459ead1f62230c705e4}} 
\index{NetHost@{NetHost}!check\_msg\_\_TOLD@{check\_msg\_\_TOLD}}
\index{check\_msg\_\_TOLD@{check\_msg\_\_TOLD}!NetHost@{NetHost}}
\doxysubsubsection{\texorpdfstring{check\_msg\_\_TOLD()}{check\_msg\_\_TOLD()}}
{\footnotesize\ttfamily void Net\+Host\+::check\+\_\+msg\+\_\+\+\_\+\+T\+O\+LD (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



D\+E\+P\+R\+E\+C\+A\+T\+ED. 



Definition at line 242 of file host.\+cpp.

\mbox{\Hypertarget{class_net_host_a15c41b049b4e6f960887c200a487b539}\label{class_net_host_a15c41b049b4e6f960887c200a487b539}} 
\index{NetHost@{NetHost}!client\_ipport\_set@{client\_ipport\_set}}
\index{client\_ipport\_set@{client\_ipport\_set}!NetHost@{NetHost}}
\doxysubsubsection{\texorpdfstring{client\_ipport\_set()}{client\_ipport\_set()}}
{\footnotesize\ttfamily void Net\+Host\+::client\+\_\+ipport\+\_\+set (\begin{DoxyParamCaption}\item[{std\+::string}]{ip,  }\item[{int}]{port }\end{DoxyParamCaption})}



Connect to server. 



Definition at line 110 of file host.\+cpp.

\mbox{\Hypertarget{class_net_host_a0f86d9fef85fb76f37637cf3b9187fbf}\label{class_net_host_a0f86d9fef85fb76f37637cf3b9187fbf}} 
\index{NetHost@{NetHost}!close@{close}}
\index{close@{close}!NetHost@{NetHost}}
\doxysubsubsection{\texorpdfstring{close()}{close()}}
{\footnotesize\ttfamily void Net\+Host\+::close (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [protected]}}



Close connection and socket. 



Definition at line 140 of file host.\+cpp.

\mbox{\Hypertarget{class_net_host_aa822125801031e3d4c3a01bb8dfb7216}\label{class_net_host_aa822125801031e3d4c3a01bb8dfb7216}} 
\index{NetHost@{NetHost}!connect\_to@{connect\_to}}
\index{connect\_to@{connect\_to}!NetHost@{NetHost}}
\doxysubsubsection{\texorpdfstring{connect\_to()}{connect\_to()}}
{\footnotesize\ttfamily void Net\+Host\+::connect\+\_\+to (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Definition at line 117 of file host.\+cpp.

\mbox{\Hypertarget{class_net_host_ae81503fb7c5f081274201bcb981a67a8}\label{class_net_host_ae81503fb7c5f081274201bcb981a67a8}} 
\index{NetHost@{NetHost}!get\_newremote@{get\_newremote}}
\index{get\_newremote@{get\_newremote}!NetHost@{NetHost}}
\doxysubsubsection{\texorpdfstring{get\_newremote()}{get\_newremote()}}
{\footnotesize\ttfamily \mbox{\hyperlink{class_net_remote}{Net\+Remote}} $\ast$ Net\+Host\+::get\+\_\+newremote (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Get last remote connection. 

\begin{DoxyReturn}{Returns}
new \mbox{\hyperlink{class_net_remote}{Net\+Remote}} 
\end{DoxyReturn}


Definition at line 159 of file host.\+cpp.

\mbox{\Hypertarget{class_net_host_a608e6eac768a93c0333c08a806d2f82a}\label{class_net_host_a608e6eac768a93c0333c08a806d2f82a}} 
\index{NetHost@{NetHost}!open@{open}}
\index{open@{open}!NetHost@{NetHost}}
\doxysubsubsection{\texorpdfstring{open()}{open()}}
{\footnotesize\ttfamily void Net\+Host\+::open (\begin{DoxyParamCaption}\item[{int}]{port }\end{DoxyParamCaption})}



Start server. 



Definition at line 80 of file host.\+cpp.

\mbox{\Hypertarget{class_net_host_a15a007c20889ad43452096db5d6a5bb0}\label{class_net_host_a15a007c20889ad43452096db5d6a5bb0}} 
\index{NetHost@{NetHost}!push\_message@{push\_message}}
\index{push\_message@{push\_message}!NetHost@{NetHost}}
\doxysubsubsection{\texorpdfstring{push\_message()}{push\_message()}}
{\footnotesize\ttfamily void Net\+Host\+::push\+\_\+message (\begin{DoxyParamCaption}\item[{int32\+\_\+t}]{callback\+\_\+id,  }\item[{std\+::string}]{str }\end{DoxyParamCaption})}



Definition at line 191 of file host.\+cpp.

\mbox{\Hypertarget{class_net_host_a98639e6953680f5a7b95df321543de73}\label{class_net_host_a98639e6953680f5a7b95df321543de73}} 
\index{NetHost@{NetHost}!send\_remote@{send\_remote}}
\index{send\_remote@{send\_remote}!NetHost@{NetHost}}
\doxysubsubsection{\texorpdfstring{send\_remote()}{send\_remote()}}
{\footnotesize\ttfamily void Net\+Host\+::send\+\_\+remote (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{class_net_message}{Net\+Message}} $\ast$}]{msg }\end{DoxyParamCaption})}



Push Net\+Messages to remotes (server or clients) 



Definition at line 215 of file host.\+cpp.

\mbox{\Hypertarget{class_net_host_ae6c89d782e950ab20b24c8415639b898}\label{class_net_host_ae6c89d782e950ab20b24c8415639b898}} 
\index{NetHost@{NetHost}!thread\_launch@{thread\_launch}}
\index{thread\_launch@{thread\_launch}!NetHost@{NetHost}}
\doxysubsubsection{\texorpdfstring{thread\_launch()}{thread\_launch()}}
{\footnotesize\ttfamily void Net\+Host\+::thread\+\_\+launch (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Thread launcher. 



Definition at line 70 of file host.\+cpp.

\mbox{\Hypertarget{class_net_host_a190ad3c2e89a9ce298b5cd2134911f70}\label{class_net_host_a190ad3c2e89a9ce298b5cd2134911f70}} 
\index{NetHost@{NetHost}!thread\_loop@{thread\_loop}}
\index{thread\_loop@{thread\_loop}!NetHost@{NetHost}}
\doxysubsubsection{\texorpdfstring{thread\_loop()}{thread\_loop()}}
{\footnotesize\ttfamily void Net\+Host\+::thread\+\_\+loop (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Host loop. 



Definition at line 34 of file host.\+cpp.



\doxysubsection{Member Data Documentation}
\mbox{\Hypertarget{class_net_host_aa160b0d53ecf24363a489fcc73d72eef}\label{class_net_host_aa160b0d53ecf24363a489fcc73d72eef}} 
\index{NetHost@{NetHost}!m\_cbhandler@{m\_cbhandler}}
\index{m\_cbhandler@{m\_cbhandler}!NetHost@{NetHost}}
\doxysubsubsection{\texorpdfstring{m\_cbhandler}{m\_cbhandler}}
{\footnotesize\ttfamily \mbox{\hyperlink{class_s_o_j_o_t_z_1_1_callback_handler}{S\+O\+J\+O\+T\+Z\+::\+Callback\+Handler}}$\ast$ Net\+Host\+::m\+\_\+cbhandler\hspace{0.3cm}{\ttfamily [protected]}}



Call\+Back handler, allocated and init by \mbox{\hyperlink{class_server_app}{Server\+App}} or Client\+App. 



Definition at line 52 of file host.\+hpp.

\mbox{\Hypertarget{class_net_host_adb5569a721e31670e4833c8748c0e5aa}\label{class_net_host_adb5569a721e31670e4833c8748c0e5aa}} 
\index{NetHost@{NetHost}!m\_chat@{m\_chat}}
\index{m\_chat@{m\_chat}!NetHost@{NetHost}}
\doxysubsubsection{\texorpdfstring{m\_chat}{m\_chat}}
{\footnotesize\ttfamily \mbox{\hyperlink{class_s_o_j_o_t_z_1_1_chat}{S\+O\+J\+O\+T\+Z\+::\+Chat}}$\ast$ Net\+Host\+::m\+\_\+chat\hspace{0.3cm}{\ttfamily [protected]}}



Definition at line 54 of file host.\+hpp.

\mbox{\Hypertarget{class_net_host_aefe4e94b94fb403db5386af3c7e2b532}\label{class_net_host_aefe4e94b94fb403db5386af3c7e2b532}} 
\index{NetHost@{NetHost}!m\_client@{m\_client}}
\index{m\_client@{m\_client}!NetHost@{NetHost}}
\doxysubsubsection{\texorpdfstring{m\_client}{m\_client}}
{\footnotesize\ttfamily \mbox{\hyperlink{class_net_remote}{Net\+Remote}}$\ast$ Net\+Host\+::m\+\_\+client\hspace{0.3cm}{\ttfamily [protected]}}



Definition at line 53 of file host.\+hpp.

\mbox{\Hypertarget{class_net_host_a15112cf982c015062fc3725a7fad6a67}\label{class_net_host_a15112cf982c015062fc3725a7fad6a67}} 
\index{NetHost@{NetHost}!m\_client\_ip@{m\_client\_ip}}
\index{m\_client\_ip@{m\_client\_ip}!NetHost@{NetHost}}
\doxysubsubsection{\texorpdfstring{m\_client\_ip}{m\_client\_ip}}
{\footnotesize\ttfamily std\+::string Net\+Host\+::m\+\_\+client\+\_\+ip\hspace{0.3cm}{\ttfamily [private]}}



Definition at line 66 of file host.\+hpp.

\mbox{\Hypertarget{class_net_host_add1302b7803a60fa9b3067bf7a46d309}\label{class_net_host_add1302b7803a60fa9b3067bf7a46d309}} 
\index{NetHost@{NetHost}!m\_client\_port@{m\_client\_port}}
\index{m\_client\_port@{m\_client\_port}!NetHost@{NetHost}}
\doxysubsubsection{\texorpdfstring{m\_client\_port}{m\_client\_port}}
{\footnotesize\ttfamily int Net\+Host\+::m\+\_\+client\+\_\+port\hspace{0.3cm}{\ttfamily [private]}}



Definition at line 67 of file host.\+hpp.

\mbox{\Hypertarget{class_net_host_a8f096b083a96cea995f77d2ffb7a7047}\label{class_net_host_a8f096b083a96cea995f77d2ffb7a7047}} 
\index{NetHost@{NetHost}!m\_mutex@{m\_mutex}}
\index{m\_mutex@{m\_mutex}!NetHost@{NetHost}}
\doxysubsubsection{\texorpdfstring{m\_mutex}{m\_mutex}}
{\footnotesize\ttfamily \mbox{\hyperlink{sojotz_8hpp_a2cf3c22d8cacfe663a4eec13d0fb26ef}{M\+U\+T\+EX}}$\ast$ Net\+Host\+::m\+\_\+mutex\hspace{0.3cm}{\ttfamily [private]}}



Definition at line 61 of file host.\+hpp.

\mbox{\Hypertarget{class_net_host_a3a03ba0dc66654174cf64cfdb2e6456b}\label{class_net_host_a3a03ba0dc66654174cf64cfdb2e6456b}} 
\index{NetHost@{NetHost}!m\_newremotes@{m\_newremotes}}
\index{m\_newremotes@{m\_newremotes}!NetHost@{NetHost}}
\doxysubsubsection{\texorpdfstring{m\_newremotes}{m\_newremotes}}
{\footnotesize\ttfamily \mbox{\hyperlink{class_s_o_j_o_t_z_1_1_s_queue}{S\+O\+J\+O\+T\+Z\+::\+S\+Queue}}$<$\mbox{\hyperlink{class_s_o_j_o_t_z_1_1_ref_object}{S\+O\+J\+O\+T\+Z\+::\+Ref\+Object}}$>$ Net\+Host\+::m\+\_\+newremotes\hspace{0.3cm}{\ttfamily [private]}}



Definition at line 65 of file host.\+hpp.

\mbox{\Hypertarget{class_net_host_a6f063d7a2b2ee6aa79971a08a70ba6c0}\label{class_net_host_a6f063d7a2b2ee6aa79971a08a70ba6c0}} 
\index{NetHost@{NetHost}!m\_server@{m\_server}}
\index{m\_server@{m\_server}!NetHost@{NetHost}}
\doxysubsubsection{\texorpdfstring{m\_server}{m\_server}}
{\footnotesize\ttfamily \mbox{\hyperlink{class_net_t_c_p_server}{Net\+T\+C\+P\+Server}}$\ast$ Net\+Host\+::m\+\_\+server\hspace{0.3cm}{\ttfamily [private]}}



Definition at line 62 of file host.\+hpp.

\mbox{\Hypertarget{class_net_host_a0ff07f82fae36c36f73de82b8c455a14}\label{class_net_host_a0ff07f82fae36c36f73de82b8c455a14}} 
\index{NetHost@{NetHost}!m\_serverOn@{m\_serverOn}}
\index{m\_serverOn@{m\_serverOn}!NetHost@{NetHost}}
\doxysubsubsection{\texorpdfstring{m\_serverOn}{m\_serverOn}}
{\footnotesize\ttfamily bool Net\+Host\+::m\+\_\+server\+On\hspace{0.3cm}{\ttfamily [private]}}



Definition at line 63 of file host.\+hpp.

\mbox{\Hypertarget{class_net_host_ac2bfed849a481a789e709ccd45a77093}\label{class_net_host_ac2bfed849a481a789e709ccd45a77093}} 
\index{NetHost@{NetHost}!m\_tcpsocketset@{m\_tcpsocketset}}
\index{m\_tcpsocketset@{m\_tcpsocketset}!NetHost@{NetHost}}
\doxysubsubsection{\texorpdfstring{m\_tcpsocketset}{m\_tcpsocketset}}
{\footnotesize\ttfamily \mbox{\hyperlink{class_net_t_c_p_socket_set}{Net\+T\+C\+P\+Socket\+Set}}$\ast$ Net\+Host\+::m\+\_\+tcpsocketset\hspace{0.3cm}{\ttfamily [private]}}



Definition at line 64 of file host.\+hpp.



The documentation for this class was generated from the following files\+:\begin{DoxyCompactItemize}
\item 
sojotz/utils/net/\mbox{\hyperlink{host_8hpp}{host.\+hpp}}\item 
sojotz/utils/net/\mbox{\hyperlink{host_8cpp}{host.\+cpp}}\end{DoxyCompactItemize}
