Sophie

Sophie

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

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

\section{ost::TCPSession Class Reference}
\label{classost_1_1_t_c_p_session}\index{ost::TCPSession@{ost::TCPSession}}
The TCP session is used to primarily to represent a client connection that can be managed on a seperate thread.Threaded streamable socket with non-blocking constructor.  


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

Inheritance diagram for ost::TCPSession::\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=3cm]{classost_1_1_t_c_p_session}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf TCPSession} (const {\bf IPV4Host} \&host, {\bf tpport\_\-t} port, size\_\-t size=536, int pri=0, size\_\-t stack=0)
\begin{CompactList}\small\item\em Create a TCP socket that will be connected to a remote TCP server and that will execute under it's own thread. \item\end{CompactList}\item 
{\bf TCPSession} (const {\bf IPV6Host} \&host, {\bf tpport\_\-t} port, size\_\-t size=536, int pri=0, size\_\-t stack=0)
\item 
{\bf TCPSession} ({\bf TCPSocket} \&server, int pri=0, size\_\-t stack=0)
\begin{CompactList}\small\item\em Create a TCP socket from a bound TCP server by accepting a pending connection from that server and execute a thread for the accepted connection. \item\end{CompactList}\item 
{\bf TCPSession} ({\bf TCPV6Socket} \&server, int pri=0, size\_\-t stack=0)
\item 
virtual {\bf $\sim$TCPSession} ()
\begin{CompactList}\small\item\em Make sure destruction happens through a virtual. \item\end{CompactList}\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
int {\bf wait\-Connection} ({\bf timeout\_\-t} {\bf timeout}=TIMEOUT\_\-INF)
\begin{CompactList}\small\item\em Normally called during the thread Initial() method by default, this will wait for the socket connection to complete when connecting to a remote socket. \item\end{CompactList}\item 
void {\bf initial} (void)
\begin{CompactList}\small\item\em The initial method is used to esablish a connection when delayed completion is used. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
The TCP session is used to primarily to represent a client connection that can be managed on a seperate thread.Threaded streamable socket with non-blocking constructor. 

The TCP session also supports a non-blocking connection scheme which prevents blocking during the constructor and moving the process of completing a connection into the thread that executes for the session.

\begin{Desc}
\item[Author:]David Sugar $<${\tt dyfet@ostel.com}$>$ \end{Desc}
\begin{Desc}
\item[Examples: ]\par


{\bf tcpthread.cpp}.\end{Desc}




\subsection{Constructor \& Destructor Documentation}
\index{ost::TCPSession@{ost::TCPSession}!TCPSession@{TCPSession}}
\index{TCPSession@{TCPSession}!ost::TCPSession@{ost::TCPSession}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}ost::TCPSession::TCPSession (const {\bf IPV4Host} \& {\em host}, {\bf tpport\_\-t} {\em port}, size\_\-t {\em size} = {\tt 536}, int {\em pri} = {\tt 0}, size\_\-t {\em stack} = {\tt 0})}\label{classost_1_1_t_c_p_session_70bc06626fdd05d061772794255f64e7}


Create a TCP socket that will be connected to a remote TCP server and that will execute under it's own thread. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em host}]internet address of remote TCP server. \item[{\em port}]number of remote server. \item[{\em size}]of streaming buffer. \item[{\em pri}]execution priority relative to parent. \item[{\em stack}]allocation needed on some platforms. \end{description}
\end{Desc}
\index{ost::TCPSession@{ost::TCPSession}!TCPSession@{TCPSession}}
\index{TCPSession@{TCPSession}!ost::TCPSession@{ost::TCPSession}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}ost::TCPSession::TCPSession (const {\bf IPV6Host} \& {\em host}, {\bf tpport\_\-t} {\em port}, size\_\-t {\em size} = {\tt 536}, int {\em pri} = {\tt 0}, size\_\-t {\em stack} = {\tt 0})}\label{classost_1_1_t_c_p_session_4d3b25b7a96a1ea0115182740096b824}


\index{ost::TCPSession@{ost::TCPSession}!TCPSession@{TCPSession}}
\index{TCPSession@{TCPSession}!ost::TCPSession@{ost::TCPSession}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}ost::TCPSession::TCPSession ({\bf TCPSocket} \& {\em server}, int {\em pri} = {\tt 0}, size\_\-t {\em stack} = {\tt 0})}\label{classost_1_1_t_c_p_session_25cbaa17d60d4dc693bf48bd36933231}


Create a TCP socket from a bound TCP server by accepting a pending connection from that server and execute a thread for the accepted connection. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em server}]tcp socket to accept a connection from. \item[{\em pri}]execution priority relative to parent. \item[{\em stack}]allocation needed on some platforms. \end{description}
\end{Desc}
\index{ost::TCPSession@{ost::TCPSession}!TCPSession@{TCPSession}}
\index{TCPSession@{TCPSession}!ost::TCPSession@{ost::TCPSession}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}ost::TCPSession::TCPSession ({\bf TCPV6Socket} \& {\em server}, int {\em pri} = {\tt 0}, size\_\-t {\em stack} = {\tt 0})}\label{classost_1_1_t_c_p_session_f6d0c9073780fd0549b79c1131fec04f}


\index{ost::TCPSession@{ost::TCPSession}!~TCPSession@{$\sim$TCPSession}}
\index{~TCPSession@{$\sim$TCPSession}!ost::TCPSession@{ost::TCPSession}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual ost::TCPSession::$\sim$TCPSession ()\hspace{0.3cm}{\tt  [virtual]}}\label{classost_1_1_t_c_p_session_4d5b8693e78bab5c68c2e8ea1c2c024c}


Make sure destruction happens through a virtual. 

.. 

\subsection{Member Function Documentation}
\index{ost::TCPSession@{ost::TCPSession}!initial@{initial}}
\index{initial@{initial}!ost::TCPSession@{ost::TCPSession}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void ost::TCPSession::initial (void)\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classost_1_1_t_c_p_session_d0a0568018d48cc3079222156a6af093}


The initial method is used to esablish a connection when delayed completion is used. 

This assures the constructor terminates without having to wait for a connection request to complete. 

Reimplemented from {\bf ost::Thread} {\rm (p.\,\pageref{classost_1_1_thread_300c229e76725eeddc69867f7ecea91f})}.\index{ost::TCPSession@{ost::TCPSession}!waitConnection@{waitConnection}}
\index{waitConnection@{waitConnection}!ost::TCPSession@{ost::TCPSession}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ost::TCPSession::wait\-Connection ({\bf timeout\_\-t} {\em timeout} = {\tt TIMEOUT\_\-INF})\hspace{0.3cm}{\tt  [protected]}}\label{classost_1_1_t_c_p_session_fed206d2ae166a3f40dbea3eab924a34}


Normally called during the thread Initial() method by default, this will wait for the socket connection to complete when connecting to a remote socket. 

One might wish to use {\bf set\-Completion()}{\rm (p.\,\pageref{classost_1_1_socket_16eb72794ce956b2af6b935eb59b2e24})} to change the socket back to blocking I/O calls after the connection completes. To implement the session one must create a derived class which implements {\bf run()}{\rm (p.\,\pageref{classost_1_1_thread_dd7d339d94b8a1ed2b2b0324a95b7e74})}.

\begin{Desc}
\item[Returns:]0 if successful, -1 if timed out. \end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em timeout}]to wait for completion in milliseconds. \end{description}
\end{Desc}


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