blob: ce5ba41b9e9353deb244216121f4f3292c758260 [file] [log] [blame]
<!DOCTYPE html>
<html lang="en">
<head>
<title>4.1 - Session Configuration &mdash; Apache MINA</title>
<link href="/assets/css/common.css" rel="stylesheet" type="text/css"/>
<link href="/assets/css/mina.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<script src="https://www.apachecon.com/event-images/snippet.js"></script>
<div id="container">
<div id="header">
<div id="subProjectsNavBar">
<a href="/">
Apache MINA Project
</a>
&nbsp;|&nbsp;
<a href="/mina-project/">
<strong>MINA</strong>
</a>
&nbsp;|&nbsp;
<a href="/asyncweb-project/">
AsyncWeb
</a>
&nbsp;|&nbsp;
<a href="/ftpserver-project/">
FtpServer
</a>
&nbsp;|&nbsp;
<a href="/sshd-project/">
SSHD
</a>
&nbsp;|&nbsp;
<a href="/vysper-project/">
Vysper
</a>
</div>
</div>
<div id="content">
<div id="leftColumn">
<div id="navigation">
<a class="acevent" data-format="wide" data-width="170"></a>
<h5>Social Networks</h5>
<ul>
<li><a href="https://fosstodon.org/@apachemina">Apache MINA Mastodon</a></li>
</ul>
<h5>Latest Downloads</h5>
<ul>
<li><a href="/mina-project/downloads_2_0.html">Mina 2.0.25</a></li>
<li><a href="/mina-project/downloads_2_1.html">Mina 2.1.8</a></li>
<li><a href="/mina-project/downloads_2_2.html">Mina 2.2.3</a></li>
<li><a href="/mina-project/downloads_old.html">Mina old versions</a></li>
</ul>
<h5>Documentation</h5>
<ul>
<li><a href="/mina-project/documentation.html" class="external-link" rel="nofollow">Base documentation</a></li>
<li><a href="/mina-project/userguide/user-guide-toc.html" class="external-link" rel="nofollow">User guide</a></li>
<li><a href="/mina-project/2.2-vs-2.1.html" class="external-link" rel="nofollow">2.2 vs 2.1</a></li>
<li><a href="/mina-project/2.1-vs-2.0.html" class="external-link" rel="nofollow">2.1 vs 2.0</a></li>
<li><a href="/mina-project/features.html" class="external-link" rel="nofollow">Features</a></li>
<li><a href="/mina-project/road-map.html" class="external-link" rel="nofollow">Road Map</a></li>
<li><a href="/mina-project/quick-start-guide.html" class="external-link" rel="nofollow">Quick Start Guide</a></li>
<li><a href="/mina-project/faq.html" class="external-link" rel="nofollow">FAQ</a></li>
</ul>
<h5>Resources</h5>
<ul>
<li><a href="/mina-project/mailing-lists.html" class="external-link" rel="nofollow">Mailing lists &amp; IRC</a></li>
<li><a href="/mina-project/issue-tracking.html" class="external-link" rel="nofollow">Issue tracking</a></li>
<li><a href="/mina-project/sources.html" class="external-link" rel="nofollow">Sources</a></li>
<li><a href="/mina-project/gen-docs/latest-2.0/apidocs/index.html" class="external-link" rel="nofollow">API Javadoc 2.0.25</a></li>
<li><a href="/mina-project/gen-docs/latest-2.1/apidocs/index.html" class="external-link" rel="nofollow">API Javadoc 2.1.8</a></li>
<li><a href="/mina-project/gen-docs/latest-2.2/apidocs/index.html" class="external-link" rel="nofollow">API Javadoc 2.2.3</a></li>
<li><a href="/mina-project/gen-docs/latest-2.0/xref/index.html" class="external-link" rel="nofollow">API xref 2.0.25</a></li>
<li><a href="/mina-project/gen-docs/latest-2.1/xref/index.html" class="external-link" rel="nofollow">API xref 2.1.8</a></li>
<li><a href="/mina-project/gen-docs/latest-2.2/xref/index.html" class="external-link" rel="nofollow">API xref 2.2.3</a></li>
<li><a href="/mina-project/performances.html" class="external-link" rel="nofollow">Performances</a></li>
<li><a href="/mina-project/testimonials.html" class="external-link" rel="nofollow">Testimonials</a></li>
<li><a href="/mina-project/conferences.html" class="external-link" rel="nofollow">Conferences</a></li>
<li><a href="/mina-project/developer-guide.html" class="external-link" rel="nofollow">Developers Guide</a></li>
<li><a href="/mina-project/related-projects.html" class="external-link" rel="nofollow">Related Projects</a></li>
<li><a href="https://people.apache.org/~vgritsenko/stats/projects/mina.html" class="external-link" rel="nofollow">Statistics</a></li>
</ul>
<h5>Community</h5>
<ul>
<li><a href="https://www.apache.org/foundation/contributing.html" class="external-link" rel="nofollow">Contributing</a></li>
<li><a href="/contributors.html" class="external-link" rel="nofollow">Team</a></li>
<li><a href="/special-thanks.html" class="external-link" rel="nofollow">Special Thanks</a></li>
<li><a href="https://www.apache.org/security/" class="external-link" rel="nofollow">Security</a></li>
</ul>
<h5>About Apache</h5>
<ul>
<li><a href="https://www.apache.org" class="external-link" rel="nofollow">Apache main site</a></li>
<li><a href="https://www.apache.org/licenses/" class="external-link" rel="nofollow">License</a></li>
<li><a href="https://www.apache.org/foundation/sponsorship.html" title="The ASF sponsorship program" class="external-link" rel="nofollow">Sponsorship program</a></li>
<li><a href="https://www.apache.org/foundation/thanks.html" class="external-link" rel="nofollow">Thanks</a></li>
</ul>
<h3><a name="Navigation-Upcoming"></a>Upcoming</h3>
<ul>
<li>No event</li>
</ul>
</div>
</div>
<div id="rightColumn">
<div class="nav">
<div class="nav_prev">
<a href="ch4-session.html">Chapter 4 - Session</a>
</div>
<div class="nav_up">
<a href="ch4-session.html">Chapter 4 - Session</a>
</div>
<div class="nav_next">
<a href="ch4.2-session-statistics.html">4.2 - Session Statistics</a>
</div>
<div class="clearfix"></div>
</div>
<h1 id="41---session-configuration">4.1 - Session Configuration</h1>
<p>Depending on the Session&rsquo;s type, we can configure various elements. Some of those elements are shared across all the session&rsquo;s type, some other are specific.</p>
<p>We currently support 4 session flavors :</p>
<ul>
<li>Socket : support for the TCP transport</li>
<li>Datagram : support for the UDP transport</li>
<li>Serial : support for the RS232 transport</li>
<li>VmPipe : support for the IPC transport</li>
</ul>
<h2 id="general-parameters">General parameters</h2>
<p>Here is the list of all the global parameters (they can be set fo any of the Session flavors) :</p>
<table>
<thead>
<tr>
<th>Parameter</th>
<th>type</th>
<th>Description</th>
<th>Default value</th>
</tr>
</thead>
<tbody>
<tr>
<td>idleTimeForBoth</td>
<td>int</td>
<td>The number of seconds to wait before notify a session that is idle on reads and writes</td>
<td>Infinite</td>
</tr>
<tr>
<td>idleTimeForRead</td>
<td>int</td>
<td>The number of seconds to wait before notify a session that is idle on reads</td>
<td>Infinite</td>
</tr>
<tr>
<td>idleTimeForWrite</td>
<td>int</td>
<td>The number of seconds to wait before notify a session that is idle on writes</td>
<td>Infinite</td>
</tr>
<tr>
<td>maxReadBufferSize</td>
<td>int</td>
<td>The maximum size of the buffer used to read incoming data</td>
<td>65536 bytes</td>
</tr>
<tr>
<td>minReadBufferSize</td>
<td>int</td>
<td>The minimal size of the buffer used to read incoming data</td>
<td>64 bytes</td>
</tr>
<tr>
<td>readBufferSize</td>
<td>int</td>
<td>The default size of the buffer used to read incoming data</td>
<td>2048 bytes</td>
</tr>
<tr>
<td>throughputCalculationInterval</td>
<td>int</td>
<td>The interval (seconds) between each throughput calculation.</td>
<td>3s</td>
</tr>
<tr>
<td>useReadOperation</td>
<td>boolean</td>
<td>A flag set to TRUE when we allow an application to do a _<em>session.read()</em></td>
<td>FALSE</td>
</tr>
<tr>
<td>writeTimeout</td>
<td>int</td>
<td>Delay to wait for completion before bailing out a write operation</td>
<td>60s</td>
</tr>
</tbody>
</table>
<p>All those parameters can be accessed through the use of getters and setters (the <em>useReadOperation</em> parameter getter is using the <em>isUseReadOperation()</em> method).</p>
<h2 id="socket-specific-parameters">Socket specific parameters</h2>
<table>
<thead>
<tr>
<th>Parameter</th>
<th>type</th>
<th>Description</th>
<th>Default value</th>
</tr>
</thead>
<tbody>
<tr>
<td>defaultReuseAddress</td>
<td>boolean</td>
<td>The value for the SO_REUSEADDR flag</td>
<td>true</td>
</tr>
<tr>
<td>keepAlive</td>
<td>boolean</td>
<td>The value for the SO_KEEPALIVE flag</td>
<td>false</td>
</tr>
<tr>
<td>oobInline</td>
<td>boolean</td>
<td>The value for the SO_OOBINLINE flag</td>
<td>false</td>
</tr>
<tr>
<td>receiveBufferSize</td>
<td>int</td>
<td>The value for the SO_RCVBUF parameter</td>
<td>-1</td>
</tr>
<tr>
<td>reuseAddress</td>
<td>boolean</td>
<td>The value for the SO_REUSEADDR flag</td>
<td>false</td>
</tr>
<tr>
<td>sendBufferSize</td>
<td>int</td>
<td>The value for the SO_SNDBUF parameter</td>
<td>-1</td>
</tr>
<tr>
<td>soLinger</td>
<td>int</td>
<td>The value for the SO_LINGER parameter</td>
<td>-1</td>
</tr>
<tr>
<td>tcpNoDelay</td>
<td>boolean</td>
<td>The value for the TCP_NODELAY flag</td>
<td>false</td>
</tr>
<tr>
<td>trafficClass</td>
<td>int</td>
<td>The value for the IP_TOS parameter. One of IPTOS_LOWCOST(0x02), IPTOS_RELIABILITY(0x04), IPTOS_THROUGHPUT (0x08) or IPTOS_LOWDELAY (0x10)</td>
<td>0</td>
</tr>
</tbody>
</table>
<h2 id="datagram-specific-parameters">Datagram specific parameters</h2>
<table>
<thead>
<tr>
<th>Parameter</th>
<th>type</th>
<th>Description</th>
<th>Default value</th>
</tr>
</thead>
<tbody>
<tr>
<td>broadcast</td>
<td>boolean</td>
<td>The value for the SO_BROADCAST flag</td>
<td>false</td>
</tr>
<tr>
<td>closeOnPortUnreachable</td>
<td>boolean</td>
<td>Tells if we should close the session if the port is unreachable</td>
<td>true</td>
</tr>
<tr>
<td>receiveBufferSize</td>
<td>int</td>
<td>The value for the SO_RCVBUF parameter</td>
<td>-1</td>
</tr>
<tr>
<td>reuseAddress</td>
<td>boolean</td>
<td>The value for the SO_REUSEADDR flag</td>
<td>false</td>
</tr>
<tr>
<td>sendBufferSize</td>
<td>int</td>
<td>The value for the SO_SNDBUF parameter</td>
<td>-1</td>
</tr>
<tr>
<td>trafficClass</td>
<td>int</td>
<td>The value for the IP_TOS parameter. One of IPTOS_LOWCOST(0x02), IPTOS_RELIABILITY(0x04), IPTOS_THROUGHPUT (0x08) or IPTOS_LOWDELAY (0x10)</td>
<td>0</td>
</tr>
</tbody>
</table>
<h2 id="serial-specific-parameters">Serial specific parameters</h2>
<table>
<thead>
<tr>
<th>Parameter</th>
<th>type</th>
<th>Description</th>
<th>Default value</th>
</tr>
</thead>
<tbody>
<tr>
<td>inputBufferSize</td>
<td>int</td>
<td>The input buffer size to use</td>
<td>8</td>
</tr>
<tr>
<td>lowLatency</td>
<td>boolean</td>
<td>Set the Low Latency mode</td>
<td>false</td>
</tr>
<tr>
<td>outputBufferSize</td>
<td>int</td>
<td>The output buffer size to use</td>
<td>8</td>
</tr>
<tr>
<td>receiveThreshold</td>
<td>int</td>
<td>Set the receive threshold in byte (set it to -1 for disable)</td>
<td>-1</td>
</tr>
</tbody>
</table>
<div class="nav">
<div class="nav_prev">
<a href="ch4-session.html">Chapter 4 - Session</a>
</div>
<div class="nav_up">
<a href="ch4-session.html">Chapter 4 - Session</a>
</div>
<div class="nav_next">
<a href="ch4.2-session-statistics.html">4.2 - Session Statistics</a>
</div>
<div class="clearfix"></div>
</div>
</div>
<div id="endContent"></div>
</div>
<div id="footer">
&copy; 2003-2024, <a href="https://www.apache.org">The Apache Software Foundation</a> - <a href="https://privacy.apache.org/policies/privacy-policy-public.html">Privacy Policy</a><br />
Apache MINA, MINA, Apache Vysper, Vysper, Apache SSHd, SSHd, Apache FtpServer, FtpServer, Apache AsyncWeb, AsyncWeb,
Apache, the Apache feather logo, and the Apache Mina project logos are trademarks of The Apache Software Foundation.
</div>
</div>
</body>
</html>