226 lines
9.7 KiB
TeX
226 lines
9.7 KiB
TeX
|
\hypertarget{server_8h}{}\section{server.\+h File Reference}
|
||
|
\label{server_8h}\index{server.\+h@{server.\+h}}
|
||
|
|
||
|
|
||
|
Library for opening a T\+CP server, receiving data and sending message to monitor.
|
||
|
|
||
|
|
||
|
{\ttfamily \#include \char`\"{}image.\+h\char`\"{}}\newline
|
||
|
Include dependency graph for server.\+h\+:\nopagebreak
|
||
|
\begin{figure}[H]
|
||
|
\begin{center}
|
||
|
\leavevmode
|
||
|
\includegraphics[width=350pt]{server_8h__incl}
|
||
|
\end{center}
|
||
|
\end{figure}
|
||
|
\subsection*{Macros}
|
||
|
\begin{DoxyCompactItemize}
|
||
|
\item
|
||
|
\#define \hyperlink{server_8h_af257e2a3e091629829857a2eb8931a7a}{D\+E\+F\+A\+U\+L\+T\+\_\+\+S\+E\+R\+V\+E\+R\+\_\+\+P\+O\+RT}~2323
|
||
|
\end{DoxyCompactItemize}
|
||
|
\subsection*{Functions}
|
||
|
\begin{DoxyCompactItemize}
|
||
|
\item
|
||
|
int \hyperlink{server_8h_a99b54d5b3404766f906f49605a4aa0e3}{open\+Server} (int port)
|
||
|
\begin{DoxyCompactList}\small\item\em Open server port, connect and listen to given port. \end{DoxyCompactList}\item
|
||
|
int \hyperlink{server_8h_ab65b2df50051036defe0f35366f5a3d6}{close\+Server} ()
|
||
|
\begin{DoxyCompactList}\small\item\em Close server. \end{DoxyCompactList}\item
|
||
|
int \hyperlink{server_8h_abff9f8e931ecce919588b371dc511857}{accept\+Client} ()
|
||
|
\begin{DoxyCompactList}\small\item\em Wait for a client to connect. \end{DoxyCompactList}\item
|
||
|
int \hyperlink{server_8h_a8d865d29914b980fd71ed8d347e4ec50}{send\+Data\+To\+Server} (char $\ast$data, int length)
|
||
|
\begin{DoxyCompactList}\small\item\em Send given data to monitor. \end{DoxyCompactList}\item
|
||
|
int \hyperlink{server_8h_a4c2df7961aa7379ac79d80980a1c537b}{send\+Data\+To\+Server\+For\+Client} (int client, char $\ast$data, int length)
|
||
|
\begin{DoxyCompactList}\small\item\em Send given data to monitor, using specific client ID. \end{DoxyCompactList}\item
|
||
|
int \hyperlink{server_8h_a8b66a2007f3f9ed8538428a309c9d368}{receive\+Data\+From\+Server} (char $\ast$data, int size)
|
||
|
\begin{DoxyCompactList}\small\item\em Read data from monitor. \end{DoxyCompactList}\item
|
||
|
int \hyperlink{server_8h_a247e0124af257d0cc7abc25a7c448d1b}{receive\+Data\+From\+Server\+From\+Client} (int client, char $\ast$data, int size)
|
||
|
\begin{DoxyCompactList}\small\item\em Read data from monitor, using specific client ID. \end{DoxyCompactList}\item
|
||
|
int \hyperlink{server_8h_a51b9372f5467705aa81d76ae034c7628}{send\+Image} (\hyperlink{image_8h_a9ac2855e21920c676a108df386ff9415}{Jpg} $\ast$image)
|
||
|
\begin{DoxyCompactList}\small\item\em Send image to monitor using default client ID. \end{DoxyCompactList}\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_8h_af257e2a3e091629829857a2eb8931a7a}\label{server_8h_af257e2a3e091629829857a2eb8931a7a}}
|
||
|
\index{server.\+h@{server.\+h}!D\+E\+F\+A\+U\+L\+T\+\_\+\+S\+E\+R\+V\+E\+R\+\_\+\+P\+O\+RT@{D\+E\+F\+A\+U\+L\+T\+\_\+\+S\+E\+R\+V\+E\+R\+\_\+\+P\+O\+RT}}
|
||
|
\index{D\+E\+F\+A\+U\+L\+T\+\_\+\+S\+E\+R\+V\+E\+R\+\_\+\+P\+O\+RT@{D\+E\+F\+A\+U\+L\+T\+\_\+\+S\+E\+R\+V\+E\+R\+\_\+\+P\+O\+RT}!server.\+h@{server.\+h}}
|
||
|
\subsubsection{\texorpdfstring{D\+E\+F\+A\+U\+L\+T\+\_\+\+S\+E\+R\+V\+E\+R\+\_\+\+P\+O\+RT}{DEFAULT\_SERVER\_PORT}}
|
||
|
{\footnotesize\ttfamily \#define D\+E\+F\+A\+U\+L\+T\+\_\+\+S\+E\+R\+V\+E\+R\+\_\+\+P\+O\+RT~2323}
|
||
|
|
||
|
|
||
|
|
||
|
Definition at line 30 of file server.\+h.
|
||
|
|
||
|
|
||
|
|
||
|
\subsection{Function Documentation}
|
||
|
\mbox{\Hypertarget{server_8h_abff9f8e931ecce919588b371dc511857}\label{server_8h_abff9f8e931ecce919588b371dc511857}}
|
||
|
\index{server.\+h@{server.\+h}!accept\+Client@{accept\+Client}}
|
||
|
\index{accept\+Client@{accept\+Client}!server.\+h@{server.\+h}}
|
||
|
\subsubsection{\texorpdfstring{accept\+Client()}{acceptClient()}}
|
||
|
{\footnotesize\ttfamily int accept\+Client (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}
|
||
|
|
||
|
|
||
|
|
||
|
Wait for a client to connect.
|
||
|
|
||
|
\begin{DoxyReturn}{Returns}
|
||
|
Return client Id or -\/1 if it failed
|
||
|
\end{DoxyReturn}
|
||
|
\mbox{\Hypertarget{server_8h_ab65b2df50051036defe0f35366f5a3d6}\label{server_8h_ab65b2df50051036defe0f35366f5a3d6}}
|
||
|
\index{server.\+h@{server.\+h}!close\+Server@{close\+Server}}
|
||
|
\index{close\+Server@{close\+Server}!server.\+h@{server.\+h}}
|
||
|
\subsubsection{\texorpdfstring{close\+Server()}{closeServer()}}
|
||
|
{\footnotesize\ttfamily int close\+Server (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}
|
||
|
|
||
|
|
||
|
|
||
|
Close server.
|
||
|
|
||
|
\begin{DoxyReturn}{Returns}
|
||
|
-\/1 if closing failed , 0 otherwise
|
||
|
\end{DoxyReturn}
|
||
|
\mbox{\Hypertarget{server_8h_a99b54d5b3404766f906f49605a4aa0e3}\label{server_8h_a99b54d5b3404766f906f49605a4aa0e3}}
|
||
|
\index{server.\+h@{server.\+h}!open\+Server@{open\+Server}}
|
||
|
\index{open\+Server@{open\+Server}!server.\+h@{server.\+h}}
|
||
|
\subsubsection{\texorpdfstring{open\+Server()}{openServer()}}
|
||
|
{\footnotesize\ttfamily int open\+Server (\begin{DoxyParamCaption}\item[{int}]{port }\end{DoxyParamCaption})}
|
||
|
|
||
|
|
||
|
|
||
|
Open server port, connect and listen to given port.
|
||
|
|
||
|
|
||
|
\begin{DoxyParams}{Parameters}
|
||
|
{\em port} & A valid port number (1024 -\/ 65535) \\
|
||
|
\hline
|
||
|
\end{DoxyParams}
|
||
|
\begin{DoxyReturn}{Returns}
|
||
|
-\/1 if opening failed or the socket number
|
||
|
\end{DoxyReturn}
|
||
|
\mbox{\Hypertarget{server_8h_a8b66a2007f3f9ed8538428a309c9d368}\label{server_8h_a8b66a2007f3f9ed8538428a309c9d368}}
|
||
|
\index{server.\+h@{server.\+h}!receive\+Data\+From\+Server@{receive\+Data\+From\+Server}}
|
||
|
\index{receive\+Data\+From\+Server@{receive\+Data\+From\+Server}!server.\+h@{server.\+h}}
|
||
|
\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})}
|
||
|
|
||
|
|
||
|
|
||
|
Read data from monitor.
|
||
|
|
||
|
Read, at most, size data from monitor. Data must be a valid pointer to a buffer large enough.
|
||
|
|
||
|
|
||
|
\begin{DoxyParams}{Parameters}
|
||
|
{\em data} & A valid pointer to a buffer \\
|
||
|
\hline
|
||
|
{\em size} & Amount of data to read \\
|
||
|
\hline
|
||
|
\end{DoxyParams}
|
||
|
\begin{DoxyReturn}{Returns}
|
||
|
Return amount of data really received. 0 if communication is broken
|
||
|
\end{DoxyReturn}
|
||
|
\mbox{\Hypertarget{server_8h_a247e0124af257d0cc7abc25a7c448d1b}\label{server_8h_a247e0124af257d0cc7abc25a7c448d1b}}
|
||
|
\index{server.\+h@{server.\+h}!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.\+h@{server.\+h}}
|
||
|
\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})}
|
||
|
|
||
|
|
||
|
|
||
|
Read data from monitor, using specific client ID.
|
||
|
|
||
|
Read, at most, size data from monitor. Data must be a valid pointer to a buffer large enough.
|
||
|
|
||
|
|
||
|
\begin{DoxyParams}{Parameters}
|
||
|
{\em client} & Client Id to receive from \\
|
||
|
\hline
|
||
|
{\em data} & A valid pointer to a buffer \\
|
||
|
\hline
|
||
|
{\em size} & Amount of data to read \\
|
||
|
\hline
|
||
|
\end{DoxyParams}
|
||
|
\begin{DoxyReturn}{Returns}
|
||
|
Return amount of data really received. 0 if communication is broken
|
||
|
\end{DoxyReturn}
|
||
|
\mbox{\Hypertarget{server_8h_a8d865d29914b980fd71ed8d347e4ec50}\label{server_8h_a8d865d29914b980fd71ed8d347e4ec50}}
|
||
|
\index{server.\+h@{server.\+h}!send\+Data\+To\+Server@{send\+Data\+To\+Server}}
|
||
|
\index{send\+Data\+To\+Server@{send\+Data\+To\+Server}!server.\+h@{server.\+h}}
|
||
|
\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})}
|
||
|
|
||
|
|
||
|
|
||
|
Send given data to monitor.
|
||
|
|
||
|
Send given data to monitor using default client ID
|
||
|
|
||
|
|
||
|
\begin{DoxyParams}{Parameters}
|
||
|
{\em data} & A valid pointer to a buffer \\
|
||
|
\hline
|
||
|
{\em length} & Amount of data to send \\
|
||
|
\hline
|
||
|
\end{DoxyParams}
|
||
|
\begin{DoxyReturn}{Returns}
|
||
|
Return amount of data really written. 0 if communication is broken
|
||
|
\end{DoxyReturn}
|
||
|
\mbox{\Hypertarget{server_8h_a4c2df7961aa7379ac79d80980a1c537b}\label{server_8h_a4c2df7961aa7379ac79d80980a1c537b}}
|
||
|
\index{server.\+h@{server.\+h}!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.\+h@{server.\+h}}
|
||
|
\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})}
|
||
|
|
||
|
|
||
|
|
||
|
Send given data to monitor, using specific client ID.
|
||
|
|
||
|
Send given data to monitor using given client ID.
|
||
|
|
||
|
|
||
|
\begin{DoxyParams}{Parameters}
|
||
|
{\em client} & Client Id to send data to \\
|
||
|
\hline
|
||
|
{\em data} & A valid pointer to a buffer \\
|
||
|
\hline
|
||
|
{\em length} & Amount of data to send \\
|
||
|
\hline
|
||
|
\end{DoxyParams}
|
||
|
\begin{DoxyReturn}{Returns}
|
||
|
Return amount of data really written. 0 if communication is broken
|
||
|
\end{DoxyReturn}
|
||
|
\mbox{\Hypertarget{server_8h_a51b9372f5467705aa81d76ae034c7628}\label{server_8h_a51b9372f5467705aa81d76ae034c7628}}
|
||
|
\index{server.\+h@{server.\+h}!send\+Image@{send\+Image}}
|
||
|
\index{send\+Image@{send\+Image}!server.\+h@{server.\+h}}
|
||
|
\subsubsection{\texorpdfstring{send\+Image()}{sendImage()}}
|
||
|
{\footnotesize\ttfamily int send\+Image (\begin{DoxyParamCaption}\item[{\hyperlink{image_8h_a9ac2855e21920c676a108df386ff9415}{Jpg} $\ast$}]{image }\end{DoxyParamCaption})}
|
||
|
|
||
|
|
||
|
|
||
|
Send image to monitor using default client ID.
|
||
|
|
||
|
Convert image to raw data, and add correct header before sending to monitor
|
||
|
|
||
|
|
||
|
\begin{DoxyParams}{Parameters}
|
||
|
{\em image} & An image object after compression \\
|
||
|
\hline
|
||
|
\end{DoxyParams}
|
||
|
\begin{DoxyReturn}{Returns}
|
||
|
Return amount of data really received. 0 if communication is broken
|
||
|
\end{DoxyReturn}
|