<?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: Session</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">Session</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../files/lib/network/session_rb.html">
lib/network/session.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Object
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="diagram">
<map id="map" name="map">
<area shape="rect" coords="5,101,77,149" href="Session.html" alt="Session
" />
<area shape="rect" coords="5,5,77,53" href="Publisher.html" alt="Publisher
" />
</map>
<img src="../dot/f_40.png" usemap="#map" border="0" alt="dot/f_40.png">
</div>
<div id="description">
<p>
The session class is a base class contains the minimum amount of attributes
to reasonably maintain a socket session with a client.
</p>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000143">handle_close</a>
<a href="#M000141">handle_input</a>
<a href="#M000144">handle_oob</a>
<a href="#M000142">handle_output</a>
<a href="#M000140">init</a>
<a href="#M000145">is_readable?</a>
<a href="#M000146">is_writable?</a>
<a href="#M000139">new</a>
</div>
</div>
</div>
<!-- if includes -->
<div id="includes">
<h3 class="section-bar">Included Modules</h3>
<div id="includes-list">
<span class="include-name"><a href="Publisher.html">Publisher</a></span>
</div>
</div>
<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">accepting</td>
<td class="context-item-value"> [RW] </td>
<td class="context-item-desc"></td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">closing</td>
<td class="context-item-value"> [RW] </td>
<td class="context-item-desc"></td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">connected</td>
<td class="context-item-value"> [RW] </td>
<td class="context-item-desc"></td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">sock</td>
<td class="context-item-value"> [R] </td>
<td class="context-item-desc"></td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">write_blocked</td>
<td class="context-item-value"> [RW] </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-M000139" class="method-detail">
<a name="M000139"></a>
<div class="method-heading">
<a href="#M000139" class="method-signature">
<span class="method-name">new</span><span class="method-args">(server, sock=nil)</span>
</a>
</div>
<div class="method-description">
<p>
Create a <a href="Session.html#M000139">new</a> session object Used when
opening both an acceptor or connection.
</p>
<dl>
<dt><tt>server</tt></dt><dd>The reactor or connector this session is associated with.
</dd>
<dt><tt>sock</tt></dt><dd>Nil for acceptors or the socket for connections.
</dd>
<dt><tt>returns</tt></dt><dd>A session object.
</dd>
</dl>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000139-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000139-source">
<pre>
<span class="ruby-comment cmt"># File lib/network/session.rb, line 32</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">server</span>, <span class="ruby-identifier">sock</span>=<span class="ruby-keyword kw">nil</span>)
<span class="ruby-ivar">@server</span> = <span class="ruby-identifier">server</span> <span class="ruby-comment cmt"># Reactor or connector associated with this session.</span>
<span class="ruby-ivar">@sock</span> = <span class="ruby-identifier">sock</span> <span class="ruby-comment cmt"># File descriptor handle for this session.</span>
<span class="ruby-ivar">@addr</span> = <span class="ruby-value str">""</span> <span class="ruby-comment cmt"># Network address of this socket.</span>
<span class="ruby-ivar">@accepting</span>=<span class="ruby-ivar">@connected</span>=<span class="ruby-ivar">@closing</span>=<span class="ruby-ivar">@write_blocked</span>=<span class="ruby-keyword kw">false</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000143" class="method-detail">
<a name="M000143"></a>
<div class="method-heading">
<a href="#M000143" class="method-signature">
<span class="method-name">handle_close</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p>
<a href="Session.html#M000143">handle_close</a> is called when a close
event occurs for this session.
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000143-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000143-source">
<pre>
<span class="ruby-comment cmt"># File lib/network/session.rb, line 54</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">handle_close</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000141" class="method-detail">
<a name="M000141"></a>
<div class="method-heading">
<a href="#M000141" class="method-signature">
<span class="method-name">handle_input</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p>
<a href="Session.html#M000141">handle_input</a> is called when an input
event occurs for this session.
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000141-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000141-source">
<pre>
<span class="ruby-comment cmt"># File lib/network/session.rb, line 46</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">handle_input</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000144" class="method-detail">
<a name="M000144"></a>
<div class="method-heading">
<a href="#M000144" class="method-signature">
<span class="method-name">handle_oob</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p>
<a href="Session.html#M000144">handle_oob</a> is called when an out of band
data event occurs for this session.
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000144-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000144-source">
<pre>
<span class="ruby-comment cmt"># File lib/network/session.rb, line 59</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">handle_oob</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000142" class="method-detail">
<a name="M000142"></a>
<div class="method-heading">
<a href="#M000142" class="method-signature">
<span class="method-name">handle_output</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p>
<a href="Session.html#M000142">handle_output</a> is called when an output
event occurs for this session.
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000142-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000142-source">
<pre>
<span class="ruby-comment cmt"># File lib/network/session.rb, line 50</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">handle_output</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000140" class="method-detail">
<a name="M000140"></a>
<div class="method-heading">
<a href="#M000140" class="method-signature">
<span class="method-name">init</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p>
<a href="Session.html#M000140">init</a> is called before using the session.
</p>
<dl>
<dt><tt>returns</tt></dt><dd>true is session object properly initialized
</dd>
</dl>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000140-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000140-source">
<pre>
<span class="ruby-comment cmt"># File lib/network/session.rb, line 41</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">init</span>
<span class="ruby-keyword kw">true</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000145" class="method-detail">
<a name="M000145"></a>
<div class="method-heading">
<a href="#M000145" class="method-signature">
<span class="method-name">is_readable?</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p>
<a href="Session.html#M000145">is_readable?</a> tests if the socket is a
candidate for select read {<tt>return</tt>] true if so, false if not
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000145-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000145-source">
<pre>
<span class="ruby-comment cmt"># File lib/network/session.rb, line 64</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">is_readable?</span>
<span class="ruby-ivar">@connected</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@accepting</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000146" class="method-detail">
<a name="M000146"></a>
<div class="method-heading">
<a href="#M000146" class="method-signature">
<span class="method-name">is_writable?</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p>
<a href="Session.html#M000146">is_writable?</a> tests if the socket is a
candidate for select write {<tt>return</tt>] true if so, false if not
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000146-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000146-source">
<pre>
<span class="ruby-comment cmt"># File lib/network/session.rb, line 70</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">is_writable?</span>
<span class="ruby-ivar">@write_blocked</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</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>