tmud-2.10.0/benchmark/
tmud-2.10.0/cmd/
tmud-2.10.0/cmd/objects/
tmud-2.10.0/cmd/tiny/
tmud-2.10.0/doc/classes/Acceptor.src/
tmud-2.10.0/doc/classes/BoolExpParser.src/
tmud-2.10.0/doc/classes/CacheStats.src/
tmud-2.10.0/doc/classes/Character.src/
tmud-2.10.0/doc/classes/Client.src/
tmud-2.10.0/doc/classes/ColorFilter.src/
tmud-2.10.0/doc/classes/Command.src/
tmud-2.10.0/doc/classes/Configuration.src/
tmud-2.10.0/doc/classes/Connector.src/
tmud-2.10.0/doc/classes/ConsoleClient.src/
tmud-2.10.0/doc/classes/CursesClient.src/
tmud-2.10.0/doc/classes/DebugFilter.src/
tmud-2.10.0/doc/classes/Dumper.src/
tmud-2.10.0/doc/classes/Engine.src/
tmud-2.10.0/doc/classes/Event.src/
tmud-2.10.0/doc/classes/EventManager.src/
tmud-2.10.0/doc/classes/Exit.src/
tmud-2.10.0/doc/classes/Farts/AttributeSyntaxNode.src/
tmud-2.10.0/doc/classes/Farts/CallSyntaxNode.src/
tmud-2.10.0/doc/classes/Farts/CommandSyntaxNode.src/
tmud-2.10.0/doc/classes/Farts/CommentSyntaxNode.src/
tmud-2.10.0/doc/classes/Farts/EndSyntaxNode.src/
tmud-2.10.0/doc/classes/Farts/IfSyntaxNode.src/
tmud-2.10.0/doc/classes/Farts/Interpreter.src/
tmud-2.10.0/doc/classes/Farts/Lexer.src/
tmud-2.10.0/doc/classes/Farts/Lib.src/
tmud-2.10.0/doc/classes/Farts/LiteralSyntaxNode.src/
tmud-2.10.0/doc/classes/Farts/LocalVarSyntaxNode.src/
tmud-2.10.0/doc/classes/Farts/Parser.src/
tmud-2.10.0/doc/classes/Farts/ProgramSyntaxNode.src/
tmud-2.10.0/doc/classes/Farts/SyntaxNode.src/
tmud-2.10.0/doc/classes/Filter.src/
tmud-2.10.0/doc/classes/LineIO.src/
tmud-2.10.0/doc/classes/Loader.src/
tmud-2.10.0/doc/classes/Log.src/
tmud-2.10.0/doc/classes/Module.src/
tmud-2.10.0/doc/classes/ObjCmd.src/
tmud-2.10.0/doc/classes/PacketIO.src/
tmud-2.10.0/doc/classes/ProtocolStack.src/
tmud-2.10.0/doc/classes/Publisher.src/
tmud-2.10.0/doc/classes/Reactor.src/
tmud-2.10.0/doc/classes/Room.src/
tmud-2.10.0/doc/classes/SQLite/
tmud-2.10.0/doc/classes/SQLite/Database.src/
tmud-2.10.0/doc/classes/SQLite3/
tmud-2.10.0/doc/classes/SQLite3/Database.src/
tmud-2.10.0/doc/classes/Script.src/
tmud-2.10.0/doc/classes/Session.src/
tmud-2.10.0/doc/classes/SockIO.src/
tmud-2.10.0/doc/classes/String.src/
tmud-2.10.0/doc/classes/TerminalFilter.src/
tmud-2.10.0/doc/classes/TernaryTrie.src/
tmud-2.10.0/doc/classes/TernaryTrie/
tmud-2.10.0/doc/classes/TernaryTrie/TNode.src/
tmud-2.10.0/doc/classes/Timer.src/
tmud-2.10.0/doc/classes/Utility.src/
tmud-2.10.0/doc/classes/XmlStore.src/
tmud-2.10.0/doc/classes/YamlStore.src/
tmud-2.10.0/doc/dot/
tmud-2.10.0/doc/files/cmd/objects/
tmud-2.10.0/doc/files/cmd/tiny/
tmud-2.10.0/doc/files/lib/
tmud-2.10.0/doc/files/lib/engine/
tmud-2.10.0/doc/files/lib/farts/
tmud-2.10.0/doc/files/tclient_rb.src/
tmud-2.10.0/doc/files/tmud_rb.src/
tmud-2.10.0/farts/
tmud-2.10.0/lib/
tmud-2.10.0/lib/core/
tmud-2.10.0/lib/engine/
tmud-2.10.0/lib/farts/
tmud-2.10.0/logs/
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: Connection</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">Connection</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../files/lib/network/connection_rb.html">
                lib/network/connection.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                <a href="Session.html">
                Session
               </a>
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">
    <div id="diagram">
      <map id="map" name="map">
  <area shape="RECT" coords="36,113,118,161"      href="Connection.html" alt="Connection
">
  <area shape="RECT" coords="41,17,113,65"      href="Session.html" alt="Session
">
</map>
<img src="../dot/f_25.png" usemap="#map" border=0 alt="TopLevel">
    </div>

    <div id="description">
      <p>
The connection class maintains a socket connection with a reactor and
handles all events dispatched by the reactor.
</p>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000250">handle_close</a>&nbsp;&nbsp;
      <a href="#M000248">handle_input</a>&nbsp;&nbsp;
      <a href="#M000251">handle_oob</a>&nbsp;&nbsp;
      <a href="#M000249">handle_output</a>&nbsp;&nbsp;
      <a href="#M000247">init</a>&nbsp;&nbsp;
      <a href="#M000246">new</a>&nbsp;&nbsp;
      <a href="#M000254">query</a>&nbsp;&nbsp;
      <a href="#M000256">sendmsg</a>&nbsp;&nbsp;
      <a href="#M000255">set</a>&nbsp;&nbsp;
      <a href="#M000252">set_initdone</a>&nbsp;&nbsp;
      <a href="#M000253">update</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





    <div id="attribute-list">
      <h3 class="section-bar">Attributes</h3>

      <div class="name-list">
        <table>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">addr</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">host</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">inbuffer</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">initdone</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">outbuffer</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">pstack</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">server</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">sockio</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        </table>
      </div>
    </div>
      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000246" class="method-detail">
        <a name="M000246"></a>

        <div class="method-heading">
          <a href="Connection.src/M000246.html" target="Code" class="method-signature"
            onclick="popupCode('Connection.src/M000246.html');return false;">
          <span class="method-name">new</span><span class="method-args">(server, sock)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Create a new connection object
</p>
<dl>
<dt><tt>server</tt></dt><dd>The reactor this connection is associated with.

</dd>
<dt><tt>sock</tt></dt><dd>The socket for this connection.

</dd>
<dt><tt>returns</tt></dt><dd>A connection object.

</dd>
</dl>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000250" class="method-detail">
        <a name="M000250"></a>

        <div class="method-heading">
          <a href="Connection.src/M000250.html" target="Code" class="method-signature"
            onclick="popupCode('Connection.src/M000250.html');return false;">
          <span class="method-name">handle_close</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
<a href="Connection.html#M000250">handle_close</a> is called to when an
close event occurs for this session.
</p>
        </div>
      </div>

      <div id="method-M000248" class="method-detail">
        <a name="M000248"></a>

        <div class="method-heading">
          <a href="Connection.src/M000248.html" target="Code" class="method-signature"
            onclick="popupCode('Connection.src/M000248.html');return false;">
          <span class="method-name">handle_input</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
<a href="Connection.html#M000248">handle_input</a> is called to order a
connection to process any input waiting on its socket. Input is parsed into
lines based on the occurance of the CRLF terminator and pushed into a
buffer which is a list of lines. The buffer expands dynamically as input is
processed. Input that has yet to see a CRLF terminator is left in the
connection&#8217;s inbuffer.
</p>
        </div>
      </div>

      <div id="method-M000251" class="method-detail">
        <a name="M000251"></a>

        <div class="method-heading">
          <a href="Connection.src/M000251.html" target="Code" class="method-signature"
            onclick="popupCode('Connection.src/M000251.html');return false;">
          <span class="method-name">handle_oob</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
<a href="Connection.html#M000251">handle_oob</a> is called when an out of
band data event occurs for this session.
</p>
        </div>
      </div>

      <div id="method-M000249" class="method-detail">
        <a name="M000249"></a>

        <div class="method-heading">
          <a href="Connection.src/M000249.html" target="Code" class="method-signature"
            onclick="popupCode('Connection.src/M000249.html');return false;">
          <span class="method-name">handle_output</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
<a href="Connection.html#M000249">handle_output</a> is called to order a
connection to process any output waiting on its socket.
</p>
        </div>
      </div>

      <div id="method-M000247" class="method-detail">
        <a name="M000247"></a>

        <div class="method-heading">
          <a href="Connection.src/M000247.html" target="Code" class="method-signature"
            onclick="popupCode('Connection.src/M000247.html');return false;">
          <span class="method-name">init</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
init is called before using the connection.
</p>
<dl>
<dt><tt>returns</tt></dt><dd>true is connection is properly initialized

</dd>
</dl>
        </div>
      </div>

      <div id="method-M000254" class="method-detail">
        <a name="M000254"></a>

        <div class="method-heading">
          <a href="Connection.src/M000254.html" target="Code" class="method-signature"
            onclick="popupCode('Connection.src/M000254.html');return false;">
          <span class="method-name">query</span><span class="method-args">(attrib)</span>
          </a>
        </div>
      
        <div class="method-description">
          <dl>
<dt><tt>attrib</tt></dt><dd>- A Symbol not handled here is assumed to be a query and

</dd>
</dl>
<pre>
          its handling is delegated to the ProtocolStack, the result
          of which is a pair immediately sent back to as a message
          to the client.

        &lt;pre&gt;
        client -&gt; us
            :echo
        us     -&gt; ProtocolStack
            query(:echo)
        ProtocolStack -&gt; us
            [:echo, true]
        us -&gt; client
            [:echo, true]
        &lt;/pre&gt;
</pre>
        </div>
      </div>

      <div id="method-M000256" class="method-detail">
        <a name="M000256"></a>

        <div class="method-heading">
          <a href="Connection.src/M000256.html" target="Code" class="method-signature"
            onclick="popupCode('Connection.src/M000256.html');return false;">
          <span class="method-name">sendmsg</span><span class="method-args">(msg)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
sendmsg places a message on the <a
href="Connection.html">Connection</a>&#8217;s output buffer.
</p>
<dl>
<dt><tt>msg</tt></dt><dd>The message, a reference to a buffer

</dd>
</dl>
        </div>
      </div>

      <div id="method-M000255" class="method-detail">
        <a name="M000255"></a>

        <div class="method-heading">
          <a href="Connection.src/M000255.html" target="Code" class="method-signature"
            onclick="popupCode('Connection.src/M000255.html');return false;">
          <span class="method-name">set</span><span class="method-args">(attrib, val)</span>
          </a>
        </div>
      
        <div class="method-description">
          <dl>
<dt>+attrib,val+</dt><dd>- An Array not handled here is assumed to be a set command and

</dd>
</dl>
<pre>
          its handling is delegated to the ProtocolStack.

        &lt;pre&gt;
        client -&gt; us
            [:color, true]
        us     -&gt; ProtocolStack
            set(:color, true)
        &lt;/pre&gt;
</pre>
        </div>
      </div>

      <div id="method-M000252" class="method-detail">
        <a name="M000252"></a>

        <div class="method-heading">
          <a href="Connection.src/M000252.html" target="Code" class="method-signature"
            onclick="popupCode('Connection.src/M000252.html');return false;">
          <span class="method-name">set_initdone</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
This is called from <a href="TelnetFilter.html">TelnetFilter</a> when we
are done with negotiations. The event :initdone wakens observer to begin
user activity
</p>
        </div>
      </div>

      <div id="method-M000253" class="method-detail">
        <a name="M000253"></a>

        <div class="method-heading">
          <a href="Connection.src/M000253.html" target="Code" class="method-signature"
            onclick="popupCode('Connection.src/M000253.html');return false;">
          <span class="method-name">update</span><span class="method-args">(msg)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Update will be called when the object the connection is observing wants to
notify us of a change in state or new message. When a new connection is
accepted in acceptor that connection is passed to the observer of the
acceptor which allows the client to attach an observer to the connection
and make the connection an observer of that object. We need to keep both
sides interest in each other limited to a narrow but flexible interface to
prevent tight coupling.
</p>
<p>
This supports the following:
</p>
<dl>
<dt>:quit</dt><dd>- This symbol message from the client is a request to

<pre>
      close the Connection.  It is handled here.
</pre>
</dd>
<dt><a href="String.html">String</a></dt><dd>- A <a href="String.html">String</a> is assumed to be output and placed in
our

<pre>
  @outbuffer.
</pre>
</dd>
</dl>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>