\section{Communicating\-Socket Class Reference}
\label{classCommunicatingSocket}\index{CommunicatingSocket@{CommunicatingSocket}}
{\tt \#include $<$Practical\-Socket.h$>$}

Inheritance diagram for Communicating\-Socket::\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=4cm]{classCommunicatingSocket}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
void {\bf connect} (const string \&foreign\-Address, unsigned short foreign\-Port)  throw (Socket\-Exception)
\item 
void {\bf send} (const void $\ast$buffer, int buffer\-Len)  throw (Socket\-Exception)
\item 
int {\bf recv} (void $\ast$buffer, int buffer\-Len)  throw (Socket\-Exception)
\item 
string {\bf get\-Foreign\-Address} ()  throw (Socket\-Exception)
\item 
unsigned short {\bf get\-Foreign\-Port} ()  throw (Socket\-Exception)
\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
{\bf Communicating\-Socket} (int type, int protocol)  throw (Socket\-Exception)
\item 
{\bf Communicating\-Socket} (int new\-Conn\-SD)
\end{CompactItemize}


\subsection{Detailed Description}
\doxyref{Socket}{p.}{classSocket} which is able to connect, send, and receive 



\subsection{Constructor \& Destructor Documentation}
\index{CommunicatingSocket@{Communicating\-Socket}!CommunicatingSocket@{CommunicatingSocket}}
\index{CommunicatingSocket@{CommunicatingSocket}!CommunicatingSocket@{Communicating\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Communicating\-Socket::Communicating\-Socket (int {\em type}, int {\em protocol})  throw ({\bf Socket\-Exception})\hspace{0.3cm}{\tt  [protected]}}\label{classCommunicatingSocket_0017517b8d6e761fde0c40475af3b2ab}


\index{CommunicatingSocket@{Communicating\-Socket}!CommunicatingSocket@{CommunicatingSocket}}
\index{CommunicatingSocket@{CommunicatingSocket}!CommunicatingSocket@{Communicating\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Communicating\-Socket::Communicating\-Socket (int {\em new\-Conn\-SD})\hspace{0.3cm}{\tt  [protected]}}\label{classCommunicatingSocket_27d758db782b3be7d28741e92cb613d1}




\subsection{Member Function Documentation}
\index{CommunicatingSocket@{Communicating\-Socket}!connect@{connect}}
\index{connect@{connect}!CommunicatingSocket@{Communicating\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Communicating\-Socket::connect (const string \& {\em foreign\-Address}, unsigned short {\em foreign\-Port})  throw ({\bf Socket\-Exception})}\label{classCommunicatingSocket_9192374d9baab8e189860aa8d913683c}


Establish a socket connection with the given foreign address and port \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em foreign\-Address}]foreign address (IP address or name) \item[{\em foreign\-Port}]foreign port \end{description}
\end{Desc}
\begin{Desc}
\item[Exceptions:]
\begin{description}
\item[{\em \doxyref{Socket\-Exception}{p.}{classSocketException}}]thrown if unable to establish connection \end{description}
\end{Desc}
\index{CommunicatingSocket@{Communicating\-Socket}!send@{send}}
\index{send@{send}!CommunicatingSocket@{Communicating\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Communicating\-Socket::send (const void $\ast$ {\em buffer}, int {\em buffer\-Len})  throw ({\bf Socket\-Exception})}\label{classCommunicatingSocket_ca4e86085c064641e86ae24ea29bbb94}


Write the given buffer to this socket. Call \doxyref{connect()}{p.}{classCommunicatingSocket_9192374d9baab8e189860aa8d913683c} before calling \doxyref{send()}{p.}{classCommunicatingSocket_ca4e86085c064641e86ae24ea29bbb94} \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em buffer}]buffer to be written \item[{\em buffer\-Len}]number of bytes from buffer to be written \end{description}
\end{Desc}
\begin{Desc}
\item[Exceptions:]
\begin{description}
\item[{\em \doxyref{Socket\-Exception}{p.}{classSocketException}}]thrown if unable to send data \end{description}
\end{Desc}
\index{CommunicatingSocket@{Communicating\-Socket}!recv@{recv}}
\index{recv@{recv}!CommunicatingSocket@{Communicating\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Communicating\-Socket::recv (void $\ast$ {\em buffer}, int {\em buffer\-Len})  throw ({\bf Socket\-Exception})}\label{classCommunicatingSocket_7cf1fd470c0060171b68df9f68c7bd01}


Read into the given buffer up to buffer\-Len bytes data from this socket. Call \doxyref{connect()}{p.}{classCommunicatingSocket_9192374d9baab8e189860aa8d913683c} before calling \doxyref{recv()}{p.}{classCommunicatingSocket_7cf1fd470c0060171b68df9f68c7bd01} \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em buffer}]buffer to receive the data \item[{\em buffer\-Len}]maximum number of bytes to read into buffer \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]number of bytes read, 0 for EOF, and -1 for error \end{Desc}
\begin{Desc}
\item[Exceptions:]
\begin{description}
\item[{\em \doxyref{Socket\-Exception}{p.}{classSocketException}}]thrown if unable to receive data \end{description}
\end{Desc}
\index{CommunicatingSocket@{Communicating\-Socket}!getForeignAddress@{getForeignAddress}}
\index{getForeignAddress@{getForeignAddress}!CommunicatingSocket@{Communicating\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}string Communicating\-Socket::get\-Foreign\-Address ()  throw ({\bf Socket\-Exception})}\label{classCommunicatingSocket_13f9eca30ef56836cf23c163c848c09e}


Get the foreign address. Call \doxyref{connect()}{p.}{classCommunicatingSocket_9192374d9baab8e189860aa8d913683c} before calling \doxyref{recv()}{p.}{classCommunicatingSocket_7cf1fd470c0060171b68df9f68c7bd01} \begin{Desc}
\item[Returns:]foreign address \end{Desc}
\begin{Desc}
\item[Exceptions:]
\begin{description}
\item[{\em \doxyref{Socket\-Exception}{p.}{classSocketException}}]thrown if unable to fetch foreign address \end{description}
\end{Desc}
\index{CommunicatingSocket@{Communicating\-Socket}!getForeignPort@{getForeignPort}}
\index{getForeignPort@{getForeignPort}!CommunicatingSocket@{Communicating\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned short Communicating\-Socket::get\-Foreign\-Port ()  throw ({\bf Socket\-Exception})}\label{classCommunicatingSocket_184fbb4775184b87ebd886a5587eb1a3}


Get the foreign port. Call \doxyref{connect()}{p.}{classCommunicatingSocket_9192374d9baab8e189860aa8d913683c} before calling \doxyref{recv()}{p.}{classCommunicatingSocket_7cf1fd470c0060171b68df9f68c7bd01} \begin{Desc}
\item[Returns:]foreign port \end{Desc}
\begin{Desc}
\item[Exceptions:]
\begin{description}
\item[{\em \doxyref{Socket\-Exception}{p.}{classSocketException}}]thrown if unable to fetch foreign port \end{description}
\end{Desc}


The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
{\bf Practical\-Socket.h}\item 
{\bf Practical\-Socket.cpp}\end{CompactItemize}
