Sophie

Sophie

distrib > Mandriva > 2007.0 > i586 > by-pkgid > ad1ba1135a9c9eeffc2e538163e00373 > files > 752

libCommonC++2_1.4-devel-1.4.1-1mdv2007.0.i586.rpm

\section{ost::Simple\-TCPStream Class Reference}
\label{classost_1_1_simple_t_c_p_stream}\index{ost::SimpleTCPStream@{ost::SimpleTCPStream}}
Simple TCP Stream, to be used with Common C++ Library.  


{\tt \#include $<$socket.h$>$}

Inheritance diagram for ost::Simple\-TCPStream::\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=2cm]{classost_1_1_simple_t_c_p_stream}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf Simple\-TCPStream} ({\bf TCPSocket} \&server, size\_\-t size=512)
\begin{CompactList}\small\item\em Create a TCP stream by accepting a connection from a bound TCP socket acting as a server. \item\end{CompactList}\item 
{\bf Simple\-TCPStream} (const {\bf IPV4Host} \&host, {\bf tpport\_\-t} port, size\_\-t size=512)
\begin{CompactList}\small\item\em Create a TCP stream by connecting to a TCP socket (on a remote machine). \item\end{CompactList}\item 
{\bf Simple\-TCPStream} (const {\bf Simple\-TCPStream} \&source)
\begin{CompactList}\small\item\em A copy constructor creates a new stream buffer. \item\end{CompactList}\item 
virtual {\bf $\sim$Simple\-TCPStream} ()
\begin{CompactList}\small\item\em Flush and empty all buffers, and then remove the allocated buffers. \item\end{CompactList}\item 
bool {\bf is\-Pending} ({\bf Pending} pend, {\bf timeout\_\-t} timeout=TIMEOUT\_\-INF)
\begin{CompactList}\small\item\em Get the status of pending stream data. \item\end{CompactList}\item 
void {\bf flush} ()
\item 
ssize\_\-t {\bf read} (char $\ast$bytes, size\_\-t length, {\bf timeout\_\-t} timeout=0)
\begin{CompactList}\small\item\em Read bytes into a buffer. \item\end{CompactList}\item 
ssize\_\-t {\bf write} (const char $\ast$bytes, size\_\-t length, {\bf timeout\_\-t} timeout=0)
\begin{CompactList}\small\item\em Write bytes to buffer. \item\end{CompactList}\item 
ssize\_\-t {\bf peek} (char $\ast$bytes, size\_\-t length, {\bf timeout\_\-t} timeout=0)
\begin{CompactList}\small\item\em Peek at the incoming data. \item\end{CompactList}\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
{\bf Simple\-TCPStream} ()
\begin{CompactList}\small\item\em The constructor required for \char`\"{}Simple\-TCPStream\char`\"{}, a more C++ style version of the {\bf Simple\-TCPStream}{\rm (p.\,\pageref{classost_1_1_simple_t_c_p_stream})} class. \item\end{CompactList}\item 
void {\bf end\-Stream} (void)
\begin{CompactList}\small\item\em Used to terminate the buffer space and cleanup the socket connection. \item\end{CompactList}\item 
void {\bf Connect} (const {\bf IPV4Host} \&host, {\bf tpport\_\-t} port, size\_\-t size)
\begin{CompactList}\small\item\em Create a TCP stream by connecting to a TCP socket (on a remote machine). \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Simple TCP Stream, to be used with Common C++ Library. 

This source is derived from a proposal made by Ville Vainio ({\tt vvainio@tp.spt.fi}).

\begin{Desc}
\item[Author:]Mark S. Millard ({\tt msm@wizzer.com}) \end{Desc}
\begin{Desc}
\item[Date:]2002-08-15 Copyright (C) 2002 Wizzer Works. \end{Desc}




\subsection{Constructor \& Destructor Documentation}
\index{ost::SimpleTCPStream@{ost::Simple\-TCPStream}!SimpleTCPStream@{SimpleTCPStream}}
\index{SimpleTCPStream@{SimpleTCPStream}!ost::SimpleTCPStream@{ost::Simple\-TCPStream}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}ost::Simple\-TCPStream::Simple\-TCPStream ()\hspace{0.3cm}{\tt  [protected]}}\label{classost_1_1_simple_t_c_p_stream_6b67fa40f1d1154f12a26c082bbb10a8}


The constructor required for \char`\"{}Simple\-TCPStream\char`\"{}, a more C++ style version of the {\bf Simple\-TCPStream}{\rm (p.\,\pageref{classost_1_1_simple_t_c_p_stream})} class. 

\index{ost::SimpleTCPStream@{ost::Simple\-TCPStream}!SimpleTCPStream@{SimpleTCPStream}}
\index{SimpleTCPStream@{SimpleTCPStream}!ost::SimpleTCPStream@{ost::Simple\-TCPStream}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}ost::Simple\-TCPStream::Simple\-TCPStream ({\bf TCPSocket} \& {\em server}, size\_\-t {\em size} = {\tt 512})}\label{classost_1_1_simple_t_c_p_stream_dbd39bbb1872fdcb5e183d495b77d803}


Create a TCP stream by accepting a connection from a bound TCP socket acting as a server. 

This performs an \char`\"{}accept\char`\"{} call.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em server}]bound server tcp socket. \item[{\em size}]of streaming input and output buffers. \end{description}
\end{Desc}
\index{ost::SimpleTCPStream@{ost::Simple\-TCPStream}!SimpleTCPStream@{SimpleTCPStream}}
\index{SimpleTCPStream@{SimpleTCPStream}!ost::SimpleTCPStream@{ost::Simple\-TCPStream}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}ost::Simple\-TCPStream::Simple\-TCPStream (const {\bf IPV4Host} \& {\em host}, {\bf tpport\_\-t} {\em port}, size\_\-t {\em size} = {\tt 512})}\label{classost_1_1_simple_t_c_p_stream_097c7d9a1ea8b74f0044f14097ea7590}


Create a TCP stream by connecting to a TCP socket (on a remote machine). 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em host}]address of remote TCP server. \item[{\em port}]number to connect. \item[{\em size}]of streaming input and output buffers. \end{description}
\end{Desc}
\index{ost::SimpleTCPStream@{ost::Simple\-TCPStream}!SimpleTCPStream@{SimpleTCPStream}}
\index{SimpleTCPStream@{SimpleTCPStream}!ost::SimpleTCPStream@{ost::Simple\-TCPStream}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}ost::Simple\-TCPStream::Simple\-TCPStream (const {\bf Simple\-TCPStream} \& {\em source})}\label{classost_1_1_simple_t_c_p_stream_9f5395676f24a75e7342aa1dcd5612c5}


A copy constructor creates a new stream buffer. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em source}]A reference to the {\bf Simple\-TCPStream}{\rm (p.\,\pageref{classost_1_1_simple_t_c_p_stream})} to copy. \end{description}
\end{Desc}
\index{ost::SimpleTCPStream@{ost::Simple\-TCPStream}!~SimpleTCPStream@{$\sim$SimpleTCPStream}}
\index{~SimpleTCPStream@{$\sim$SimpleTCPStream}!ost::SimpleTCPStream@{ost::Simple\-TCPStream}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual ost::Simple\-TCPStream::$\sim$Simple\-TCPStream ()\hspace{0.3cm}{\tt  [virtual]}}\label{classost_1_1_simple_t_c_p_stream_5871b832e999b5246d7116481aebbcbc}


Flush and empty all buffers, and then remove the allocated buffers. 



\subsection{Member Function Documentation}
\index{ost::SimpleTCPStream@{ost::Simple\-TCPStream}!Connect@{Connect}}
\index{Connect@{Connect}!ost::SimpleTCPStream@{ost::Simple\-TCPStream}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void ost::Simple\-TCPStream::Connect (const {\bf IPV4Host} \& {\em host}, {\bf tpport\_\-t} {\em port}, size\_\-t {\em size})\hspace{0.3cm}{\tt  [protected]}}\label{classost_1_1_simple_t_c_p_stream_8c1f910e36329b69b868d062150d9c58}


Create a TCP stream by connecting to a TCP socket (on a remote machine). 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em host}]address of remote TCP server. \item[{\em port}]number to connect. \item[{\em size}]of streaming input and output buffers. \end{description}
\end{Desc}
\index{ost::SimpleTCPStream@{ost::Simple\-TCPStream}!endStream@{endStream}}
\index{endStream@{endStream}!ost::SimpleTCPStream@{ost::Simple\-TCPStream}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void ost::Simple\-TCPStream::end\-Stream (void)\hspace{0.3cm}{\tt  [protected]}}\label{classost_1_1_simple_t_c_p_stream_fab6a9450b949fe1093d8b63bc343c45}


Used to terminate the buffer space and cleanup the socket connection. 

This fucntion is called by the destructor. \index{ost::SimpleTCPStream@{ost::Simple\-TCPStream}!flush@{flush}}
\index{flush@{flush}!ost::SimpleTCPStream@{ost::Simple\-TCPStream}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void ost::Simple\-TCPStream::flush ()\hspace{0.3cm}{\tt  [inline]}}\label{classost_1_1_simple_t_c_p_stream_50cdae078469b3876506ca4408f69705}


\index{ost::SimpleTCPStream@{ost::Simple\-TCPStream}!isPending@{isPending}}
\index{isPending@{isPending}!ost::SimpleTCPStream@{ost::Simple\-TCPStream}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool ost::Simple\-TCPStream::is\-Pending ({\bf Pending} {\em pend}, {\bf timeout\_\-t} {\em timeout} = {\tt TIMEOUT\_\-INF})}\label{classost_1_1_simple_t_c_p_stream_74b4194473dc3e76fd85d35930530d16}


Get the status of pending stream data. 

This method can be used to examine if input or output is waiting, or if an error or disconnect has occured on the stream. If a read buffer contains data then input is ready. If write buffer contains data, it is first flushed and then checked.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em pend}]Flag indicating means to pend. \item[{\em timeout}]The length of time to wait. \end{description}
\end{Desc}
\index{ost::SimpleTCPStream@{ost::Simple\-TCPStream}!peek@{peek}}
\index{peek@{peek}!ost::SimpleTCPStream@{ost::Simple\-TCPStream}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}ssize\_\-t ost::Simple\-TCPStream::peek (char $\ast$ {\em bytes}, size\_\-t {\em length}, {\bf timeout\_\-t} {\em timeout} = {\tt 0})}\label{classost_1_1_simple_t_c_p_stream_9beccece67bd498cbe82752dac492325}


Peek at the incoming data. 

The data is copied into the buffer but is not removed from the input queue. The function then returns the number of bytes currently pending to receive.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em bytes}]A pointer to buffer that will contain the bytes read. \item[{\em length}]The number of bytes to read (exactly). \item[{\em timeout}]Period to time out, in milleseconds.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The number of bytes pending on the input queue, 0 on EOF. \end{Desc}
\index{ost::SimpleTCPStream@{ost::Simple\-TCPStream}!read@{read}}
\index{read@{read}!ost::SimpleTCPStream@{ost::Simple\-TCPStream}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}ssize\_\-t ost::Simple\-TCPStream::read (char $\ast$ {\em bytes}, size\_\-t {\em length}, {\bf timeout\_\-t} {\em timeout} = {\tt 0})}\label{classost_1_1_simple_t_c_p_stream_582017e7f3c30d32b05eb68fbbb8ea1a}


Read bytes into a buffer. 

$<$long-description$>$

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em bytes}]A pointer to buffer that will contain the bytes read. \item[{\em length}]The number of bytes to read (exactly). \item[{\em timeout}]Period to time out, in milleseconds.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The number of bytes actually read, 0 on EOF. \end{Desc}
\index{ost::SimpleTCPStream@{ost::Simple\-TCPStream}!write@{write}}
\index{write@{write}!ost::SimpleTCPStream@{ost::Simple\-TCPStream}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}ssize\_\-t ost::Simple\-TCPStream::write (const char $\ast$ {\em bytes}, size\_\-t {\em length}, {\bf timeout\_\-t} {\em timeout} = {\tt 0})}\label{classost_1_1_simple_t_c_p_stream_671428f4e3ac21ca194dc7078b9e9489}


Write bytes to buffer. 

$<$long-description$>$

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em bytes}]A pointer to a buffer containing the bytes to write. \item[{\em length}]The number of bytes to write (exactly). \item[{\em timeout}]Period to time out, in milleseconds.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The number of bytes actually written. \end{Desc}


The documentation for this class was generated from the following file:\begin{CompactItemize}
\item 
{\bf socket.h}\end{CompactItemize}