Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > media > contrib > by-pkgid > 68d373e54fb21da3730c08bede406633 > files > 375

libCommonC++1.9_3-devel-1.9.4-2mdk.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta name="robots" content="noindex">
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>TCPSession class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body bgcolor="#ffffff">
<!-- Generated by Doxygen 1.2.5 on Thu Oct 4 15:33:01 2001 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; </center>
<hr><h1>TCPSession  Class Reference</h1>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. 
<a href="#_details">More...</a>
<p>
<code>#include &lt;<a class="el" href="socket_h-source.html">socket.h</a>&gt;</code>
<p>
<p>Inheritance diagram for TCPSession:
<p><center><img src="class_tcpsession.gif" usemap="#TCPSession_map" border="0"></center>
<map name="TCPSession_map">
<area href="class_tcpstream.html" alt="TCPStream" shape="rect" coords="99,56,188,80">
<area href="class_thread.html" alt="Thread" shape="rect" coords="198,56,287,80">
<area href="class_socket.html" alt="Socket" shape="rect" coords="0,0,89,24">
<area href="class_std__streambuf.html" alt="std::streambuf" shape="rect" coords="99,0,188,24">
<area href="class_std__iostream.html" alt="std::iostream" shape="rect" coords="198,0,287,24">
</map>
<a href="class_tcpsession-members.html">List of all members.</a><table border=0 cellpadding=0 cellspacing=0>
<tr><td colspan=2><br><h2>Public Methods</h2></td></tr>
<tr><td nowrap align=right valign=top>&nbsp;</td><td valign=bottom><a class="el" href="class_tcpsession.html#a0">TCPSession</a> (<a class="el" href="class_semaphore.html">Semaphore</a> *start, const <a class="el" href="class_inethostaddress.html">InetHostAddress</a> &amp;host, <a class="el" href="socket_h.html#a2">tpport_t</a> port, int size=512, int pri=0, int stack=0)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Create a TCP socket that will be connected to a remote TCP server and that will execute under it's own thread.</em> <a href="#a0">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>&nbsp;</td><td valign=bottom><a class="el" href="class_tcpsession.html#a1">TCPSession</a> (<a class="el" href="class_semaphore.html">Semaphore</a> *start, <a class="el" href="class_tcpsocket.html">TCPSocket</a> &amp;server, int size=512, int pri=0, int stack=0)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><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.</em> <a href="#a1">More...</a><em></em></font><br><br></td></tr>
<tr><td colspan=2><br><h2>Protected Methods</h2></td></tr>
<tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="class_tcpsession.html#b0">WaitConnection</a> (<a class="el" href="thread_h.html#a1">timeout_t</a> <a class="el" href="class_tcpstream.html#n0">timeout</a>=TIMEOUT_INF)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Normally called during the thread <a class="el" href="class_tcpsession.html#b1">Initial</a>() method by default, this will wait for the socket connection to complete when connecting to a remote socket.</em> <a href="#b0">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="class_tcpsession.html#b1">Initial</a> (void)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>The initial method is used to esablish a connection when delayed completion is used.</em> <a href="#b1">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="class_tcpsession.html#b2">Final</a> (void)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>TCPSession derived objects can be freely created with "new" and safely terminate their "Run" method on their own by self-deleting when the thread terminates.</em></font><br><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
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.
<p>
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.
<p>
<dl compact><dt>
<b>Author(s): </b><dd>
 David Sugar &lt;<a href="mailto:dyfet@ostel.com">dyfet@ostel.com</a>&gt; </dl>
<p>
<hr><h2>Constructor &amp; Destructor Documentation</h2>
<a name="a0" doxytag="TCPSession::TCPSession"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td nowrap valign="top"><b> 
TCPSession::TCPSession (
          </b></td>
          <td valign="bottom"><b>
<a class="el" href="class_semaphore.html">Semaphore</a> * <em>start</em>, 
          </b></td>
        </tr>
        <tr>
          <td></td>
          <td><b>
const <a class="el" href="class_inethostaddress.html">InetHostAddress</a> &amp; <em>host</em>, 
          </b></td>
        </tr>
        <tr>
          <td></td>
          <td><b>
<a class="el" href="socket_h.html#a2">tpport_t</a> <em>port</em>, 
          </b></td>
        </tr>
        <tr>
          <td></td>
          <td><b>
int <em>size</em> = 512, 
          </b></td>
        </tr>
        <tr>
          <td></td>
          <td><b>
int <em>pri</em> = 0, 
          </b></td>
        </tr>
        <tr>
          <td></td>
          <td><b>
int <em>stack</em> = 0&nbsp;)
          </b></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Create a TCP socket that will be connected to a remote TCP server and that will execute under it's own thread.
<p>
<dl compact><dt>
<b>Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>start</em>
&nbsp;</td><td>
 semaphore as per <a class="el" href="class_thread.html">Thread</a> startup. </td></tr>
<tr><td valign=top><em>host</em>
&nbsp;</td><td>
 internet address of remote TCP server. </td></tr>
<tr><td valign=top><em>port</em>
&nbsp;</td><td>
 number of remote server. </td></tr>
<tr><td valign=top><em>size</em>
&nbsp;</td><td>
 of streaming buffer. </td></tr>
<tr><td valign=top><em>pri</em>
&nbsp;</td><td>
 execution priority relative to parent. </td></tr>
<tr><td valign=top><em>stack</em>
&nbsp;</td><td>
 allocation needed on some platforms. </td></tr>
</table>
</dl>    </td>
  </tr>
</table>
<a name="a1" doxytag="TCPSession::TCPSession"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td nowrap valign="top"><b> 
TCPSession::TCPSession (
          </b></td>
          <td valign="bottom"><b>
<a class="el" href="class_semaphore.html">Semaphore</a> * <em>start</em>, 
          </b></td>
        </tr>
        <tr>
          <td></td>
          <td><b>
<a class="el" href="class_tcpsocket.html">TCPSocket</a> &amp; <em>server</em>, 
          </b></td>
        </tr>
        <tr>
          <td></td>
          <td><b>
int <em>size</em> = 512, 
          </b></td>
        </tr>
        <tr>
          <td></td>
          <td><b>
int <em>pri</em> = 0, 
          </b></td>
        </tr>
        <tr>
          <td></td>
          <td><b>
int <em>stack</em> = 0&nbsp;)
          </b></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
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.
<p>
<dl compact><dt>
<b>Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>start</em>
&nbsp;</td><td>
 semapore as per <a class="el" href="class_thread.html">Thread</a> startup. </td></tr>
<tr><td valign=top><em>server</em>
&nbsp;</td><td>
 tcp socket to accept a connection from. </td></tr>
<tr><td valign=top><em>size</em>
&nbsp;</td><td>
 of streaming buffer. </td></tr>
<tr><td valign=top><em>pri</em>
&nbsp;</td><td>
 execution priority relative to parent. </td></tr>
<tr><td valign=top><em>stack</em>
&nbsp;</td><td>
 allocation needed on some platforms. </td></tr>
</table>
</dl>    </td>
  </tr>
</table>
<hr><h2>Member Function Documentation</h2>
<a name="b2" doxytag="TCPSession::Final"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td nowrap valign="top"><b> 
void TCPSession::Final (
          </b></td>
          <td valign="bottom"><b>
void&nbsp;)<code> [inline, protected, virtual]</code>
          </b></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
TCPSession derived objects can be freely created with "new" and safely terminate their "Run" method on their own by self-deleting when the thread terminates.
<p>

<p>
Reimplemented from <a class="el" href="class_thread.html#b2">Thread</a>.    </td>
  </tr>
</table>
<a name="b1" doxytag="TCPSession::Initial"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td nowrap valign="top"><b> 
void TCPSession::Initial (
          </b></td>
          <td valign="bottom"><b>
void&nbsp;)<code> [protected, virtual]</code>
          </b></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
The initial method is used to esablish a connection when delayed completion is used.
<p>
This assures the constructor terminates without having to wait for a connection request to complete. 
<p>
Reimplemented from <a class="el" href="class_thread.html#b3">Thread</a>.    </td>
  </tr>
</table>
<a name="b0" doxytag="TCPSession::WaitConnection"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td nowrap valign="top"><b> 
int TCPSession::WaitConnection (
          </b></td>
          <td valign="bottom"><b>
<a class="el" href="thread_h.html#a1">timeout_t</a> <em>timeout</em> = TIMEOUT_INF&nbsp;)<code> [protected]</code>
          </b></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Normally called during the thread <a class="el" href="class_tcpsession.html#b1">Initial</a>() method by default, this will wait for the socket connection to complete when connecting to a remote socket.
<p>
One might wish to use <a class="el" href="class_socket.html#a5">setCompletion</a>() 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 <a class="el" href="class_thread.html#b0">Run</a>().
<p>
<dl compact><dt>
<b>Returns: </b><dd>
 0 if successful, -1 if timed out. </dl><dl compact><dt>
<b>Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>timeout</em>
&nbsp;</td><td>
 to wait for completion in milliseconds. </td></tr>
</table>
</dl>    </td>
  </tr>
</table>
<hr>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="socket_h-source.html">socket.h</a></ul>
<hr><address><small>Generated at Thu Oct 4 15:33:01 2001 for CommonC++ by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.gif" alt="doxygen" align="middle" border=0 
width=110 height=53></a>1.2.5 written by <a href="mailto:dimitri@stack.nl">Dimitri van Heesch</a>,
 &copy;&nbsp;1997-2001</small></address>
</body>
</html>