\hypertarget{server_8cpp}{}\section{src/server.cpp File Reference} \label{server_8cpp}\index{src/server.\+cpp@{src/server.\+cpp}} Library for opening a T\+CP server, receiving data and sending message to monitor. {\ttfamily \#include \char`\"{}server.\+h\char`\"{}}\newline {\ttfamily \#include $<$sys/socket.\+h$>$}\newline {\ttfamily \#include $<$arpa/inet.\+h$>$}\newline {\ttfamily \#include $<$netinet/in.\+h$>$}\newline {\ttfamily \#include $<$stdio.\+h$>$}\newline {\ttfamily \#include $<$stdlib.\+h$>$}\newline {\ttfamily \#include $<$unistd.\+h$>$}\newline Include dependency graph for server.\+cpp\+:\nopagebreak \begin{figure}[H] \begin{center} \leavevmode \includegraphics[width=350pt]{server_8cpp__incl} \end{center} \end{figure} \subsection*{Macros} \begin{DoxyCompactItemize} \item \#define \hyperlink{server_8cpp_ad1106125b13c36a78d012177dc2aa67c}{N\+B\+\_\+\+C\+O\+N\+N\+E\+C\+T\+I\+O\+N\+\_\+\+M\+AX}~1 \end{DoxyCompactItemize} \subsection*{Functions} \begin{DoxyCompactItemize} \item int \hyperlink{server_8cpp_a99b54d5b3404766f906f49605a4aa0e3}{open\+Server} (int port) \item int \hyperlink{server_8cpp_ab65b2df50051036defe0f35366f5a3d6}{close\+Server} () \item int \hyperlink{server_8cpp_abff9f8e931ecce919588b371dc511857}{accept\+Client} () \item int \hyperlink{server_8cpp_a8d865d29914b980fd71ed8d347e4ec50}{send\+Data\+To\+Server} (char $\ast$data, int length) \item int \hyperlink{server_8cpp_a4c2df7961aa7379ac79d80980a1c537b}{send\+Data\+To\+Server\+For\+Client} (int client, char $\ast$data, int length) \item int \hyperlink{server_8cpp_a8b66a2007f3f9ed8538428a309c9d368}{receive\+Data\+From\+Server} (char $\ast$data, int size) \item int \hyperlink{server_8cpp_a247e0124af257d0cc7abc25a7c448d1b}{receive\+Data\+From\+Server\+From\+Client} (int client, char $\ast$data, int size) \end{DoxyCompactItemize} \subsection*{Variables} \begin{DoxyCompactItemize} \item int \hyperlink{server_8cpp_a67917b0d31c20024dba33363eb8db5a2}{socket\+FD} = -\/1 \item int \hyperlink{server_8cpp_a2e938cd63a2404d0902c57205706872a}{client\+ID} = -\/1 \end{DoxyCompactItemize} \subsection{Detailed Description} Library for opening a T\+CP server, receiving data and sending message to monitor. \begin{DoxyAuthor}{Author} P\+E.\+Hladik \end{DoxyAuthor} \begin{DoxyVersion}{Version} 1.\+0 \end{DoxyVersion} \begin{DoxyDate}{Date} 06/06/2017 \end{DoxyDate} \subsection{Macro Definition Documentation} \mbox{\Hypertarget{server_8cpp_ad1106125b13c36a78d012177dc2aa67c}\label{server_8cpp_ad1106125b13c36a78d012177dc2aa67c}} \index{server.\+cpp@{server.\+cpp}!N\+B\+\_\+\+C\+O\+N\+N\+E\+C\+T\+I\+O\+N\+\_\+\+M\+AX@{N\+B\+\_\+\+C\+O\+N\+N\+E\+C\+T\+I\+O\+N\+\_\+\+M\+AX}} \index{N\+B\+\_\+\+C\+O\+N\+N\+E\+C\+T\+I\+O\+N\+\_\+\+M\+AX@{N\+B\+\_\+\+C\+O\+N\+N\+E\+C\+T\+I\+O\+N\+\_\+\+M\+AX}!server.\+cpp@{server.\+cpp}} \subsubsection{\texorpdfstring{N\+B\+\_\+\+C\+O\+N\+N\+E\+C\+T\+I\+O\+N\+\_\+\+M\+AX}{NB\_CONNECTION\_MAX}} {\footnotesize\ttfamily \#define N\+B\+\_\+\+C\+O\+N\+N\+E\+C\+T\+I\+O\+N\+\_\+\+M\+AX~1} Definition at line 35 of file server.\+cpp. \subsection{Function Documentation} \mbox{\Hypertarget{server_8cpp_abff9f8e931ecce919588b371dc511857}\label{server_8cpp_abff9f8e931ecce919588b371dc511857}} \index{server.\+cpp@{server.\+cpp}!accept\+Client@{accept\+Client}} \index{accept\+Client@{accept\+Client}!server.\+cpp@{server.\+cpp}} \subsubsection{\texorpdfstring{accept\+Client()}{acceptClient()}} {\footnotesize\ttfamily int accept\+Client (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Definition at line 71 of file server.\+cpp. \mbox{\Hypertarget{server_8cpp_ab65b2df50051036defe0f35366f5a3d6}\label{server_8cpp_ab65b2df50051036defe0f35366f5a3d6}} \index{server.\+cpp@{server.\+cpp}!close\+Server@{close\+Server}} \index{close\+Server@{close\+Server}!server.\+cpp@{server.\+cpp}} \subsubsection{\texorpdfstring{close\+Server()}{closeServer()}} {\footnotesize\ttfamily int close\+Server (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Definition at line 63 of file server.\+cpp. \mbox{\Hypertarget{server_8cpp_a99b54d5b3404766f906f49605a4aa0e3}\label{server_8cpp_a99b54d5b3404766f906f49605a4aa0e3}} \index{server.\+cpp@{server.\+cpp}!open\+Server@{open\+Server}} \index{open\+Server@{open\+Server}!server.\+cpp@{server.\+cpp}} \subsubsection{\texorpdfstring{open\+Server()}{openServer()}} {\footnotesize\ttfamily int open\+Server (\begin{DoxyParamCaption}\item[{int}]{port }\end{DoxyParamCaption})} Definition at line 40 of file server.\+cpp. \mbox{\Hypertarget{server_8cpp_a8b66a2007f3f9ed8538428a309c9d368}\label{server_8cpp_a8b66a2007f3f9ed8538428a309c9d368}} \index{server.\+cpp@{server.\+cpp}!receive\+Data\+From\+Server@{receive\+Data\+From\+Server}} \index{receive\+Data\+From\+Server@{receive\+Data\+From\+Server}!server.\+cpp@{server.\+cpp}} \subsubsection{\texorpdfstring{receive\+Data\+From\+Server()}{receiveDataFromServer()}} {\footnotesize\ttfamily int receive\+Data\+From\+Server (\begin{DoxyParamCaption}\item[{char $\ast$}]{data, }\item[{int}]{size }\end{DoxyParamCaption})} Definition at line 95 of file server.\+cpp. \mbox{\Hypertarget{server_8cpp_a247e0124af257d0cc7abc25a7c448d1b}\label{server_8cpp_a247e0124af257d0cc7abc25a7c448d1b}} \index{server.\+cpp@{server.\+cpp}!receive\+Data\+From\+Server\+From\+Client@{receive\+Data\+From\+Server\+From\+Client}} \index{receive\+Data\+From\+Server\+From\+Client@{receive\+Data\+From\+Server\+From\+Client}!server.\+cpp@{server.\+cpp}} \subsubsection{\texorpdfstring{receive\+Data\+From\+Server\+From\+Client()}{receiveDataFromServerFromClient()}} {\footnotesize\ttfamily int receive\+Data\+From\+Server\+From\+Client (\begin{DoxyParamCaption}\item[{int}]{client, }\item[{char $\ast$}]{data, }\item[{int}]{size }\end{DoxyParamCaption})} Definition at line 99 of file server.\+cpp. \mbox{\Hypertarget{server_8cpp_a8d865d29914b980fd71ed8d347e4ec50}\label{server_8cpp_a8d865d29914b980fd71ed8d347e4ec50}} \index{server.\+cpp@{server.\+cpp}!send\+Data\+To\+Server@{send\+Data\+To\+Server}} \index{send\+Data\+To\+Server@{send\+Data\+To\+Server}!server.\+cpp@{server.\+cpp}} \subsubsection{\texorpdfstring{send\+Data\+To\+Server()}{sendDataToServer()}} {\footnotesize\ttfamily int send\+Data\+To\+Server (\begin{DoxyParamCaption}\item[{char $\ast$}]{data, }\item[{int}]{length }\end{DoxyParamCaption})} Definition at line 85 of file server.\+cpp. \mbox{\Hypertarget{server_8cpp_a4c2df7961aa7379ac79d80980a1c537b}\label{server_8cpp_a4c2df7961aa7379ac79d80980a1c537b}} \index{server.\+cpp@{server.\+cpp}!send\+Data\+To\+Server\+For\+Client@{send\+Data\+To\+Server\+For\+Client}} \index{send\+Data\+To\+Server\+For\+Client@{send\+Data\+To\+Server\+For\+Client}!server.\+cpp@{server.\+cpp}} \subsubsection{\texorpdfstring{send\+Data\+To\+Server\+For\+Client()}{sendDataToServerForClient()}} {\footnotesize\ttfamily int send\+Data\+To\+Server\+For\+Client (\begin{DoxyParamCaption}\item[{int}]{client, }\item[{char $\ast$}]{data, }\item[{int}]{length }\end{DoxyParamCaption})} Definition at line 89 of file server.\+cpp. \subsection{Variable Documentation} \mbox{\Hypertarget{server_8cpp_a2e938cd63a2404d0902c57205706872a}\label{server_8cpp_a2e938cd63a2404d0902c57205706872a}} \index{server.\+cpp@{server.\+cpp}!client\+ID@{client\+ID}} \index{client\+ID@{client\+ID}!server.\+cpp@{server.\+cpp}} \subsubsection{\texorpdfstring{client\+ID}{clientID}} {\footnotesize\ttfamily int client\+ID = -\/1} Definition at line 38 of file server.\+cpp. \mbox{\Hypertarget{server_8cpp_a67917b0d31c20024dba33363eb8db5a2}\label{server_8cpp_a67917b0d31c20024dba33363eb8db5a2}} \index{server.\+cpp@{server.\+cpp}!socket\+FD@{socket\+FD}} \index{socket\+FD@{socket\+FD}!server.\+cpp@{server.\+cpp}} \subsubsection{\texorpdfstring{socket\+FD}{socketFD}} {\footnotesize\ttfamily int socket\+FD = -\/1} Definition at line 37 of file server.\+cpp.