\section{test001sockets.c File Reference}
\label{test001sockets_8c}\index{test001sockets.c@{test001sockets.c}}
This program tests the low-level tcp-socket-stream library function. 


{\tt \#include $<$stdio.h$>$}\par
{\tt \#include $<$arpa/inet.h$>$}\par
{\tt \#include $<$sys/types.h$>$}\par
{\tt \#include $<$signal.h$>$}\par
{\tt \#include \char`\"{}../lib/libcomm.h\char`\"{}}\par
\subsection*{Defines}
\begin{CompactItemize}
\item 
\#define {\bf PORT}\ 1234
\begin{CompactList}\small\item\em Port on which the server is listening and the client trys to connect.\item\end{CompactList}\item 
\#define {\bf bufsize}\ 8192
\begin{CompactList}\small\item\em How much random bytes should be transfered?\item\end{CompactList}\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
{\bf main} (int argc, char $\ast$argv[$\,$])
\begin{CompactList}\small\item\em test0001sockts: see test0001sockts.c.\item\end{CompactList}\item 
{\bf client\_\-test\_\-program} (char $\ast$server, int port)
\begin{CompactList}\small\item\em test0001sockts: see test0001sockts.c, Client Test Programm.\item\end{CompactList}\item 
{\bf server\_\-test\_\-program} (int port)
\begin{CompactList}\small\item\em test0001sockts: see test0001sockts.c, Server Test Programm.\item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
This program tests the low-level tcp-socket-stream library function.





\subsection{Define Documentation}
\index{test001sockets.c@{test001sockets.c}!bufsize@{bufsize}}
\index{bufsize@{bufsize}!test001sockets.c@{test001sockets.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define bufsize\ 8192}\label{test001sockets_8c_a1}


How much random bytes should be transfered?

\index{test001sockets.c@{test001sockets.c}!PORT@{PORT}}
\index{PORT@{PORT}!test001sockets.c@{test001sockets.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define PORT\ 1234}\label{test001sockets_8c_a0}


Port on which the server is listening and the client trys to connect.



\subsection{Function Documentation}
\index{test001sockets.c@{test001sockets.c}!client_test_program@{client\_\-test\_\-program}}
\index{client_test_program@{client\_\-test\_\-program}!test001sockets.c@{test001sockets.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}client\_\-test\_\-program (char $\ast$ {\em server}, int {\em port})}\label{test001sockets_8c_a3}


test0001sockts: see test0001sockts.c, Client Test Programm.

The client test program generates a block of n$\ast$(bufsize) random bytes, sents theses bytes to the server, receive a block from server, invert it and compare it with generated block.

BUGS: Receives only one block. If not all data ready and function resv() do noct block, data get lost. Test fails.\begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
server}]a string which contains the server name \item[{\em 
port}]an integer which specifies the port on the server \end{description}
\end{Desc}
\index{test001sockets.c@{test001sockets.c}!main@{main}}
\index{main@{main}!test001sockets.c@{test001sockets.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}main (int {\em argc}, char $\ast$ {\em argv}[$\,$])}\label{test001sockets_8c_a2}


test0001sockts: see test0001sockts.c.

\index{test001sockets.c@{test001sockets.c}!server_test_program@{server\_\-test\_\-program}}
\index{server_test_program@{server\_\-test\_\-program}!test001sockets.c@{test001sockets.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}server\_\-test\_\-program (int {\em port})}\label{test001sockets_8c_a4}


test0001sockts: see test0001sockts.c, Server Test Programm.

The server test program binds a port and waits for connections. If someone connects it reads n$\ast$(bufsize) bytes, invert all bits of these bytes and send all back.

BUGS: Receives only one block. If not all data ready and function resv() do noct block, data get lost. Test fails.\begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
port}]an integer which specifies the port to bind. \end{description}
\end{Desc}
