Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/GAP/pkg/io/doc/   (Algebra von RWTH Aachen Version 4.15.1©)  Datei vom 21.5.2025 mit Größe 22 kB image not shown  

Quelle  chap9.html   Sprache: HTML

 
 products/Sources/formale Sprachen/GAP/pkg/io/doc/chap9.html


<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE
<htmlxmlnshttp/.3org9xhtmlxml:lang=en

<html xmlns="http://www.w3.org
<head>
<title>GAP (IO) - Chapter 9: I/O multiplexing</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta name="generator" content="GAPDoc2HTML" />
<link rel="stylesheet" type="text/css" href="manual.css" />
<script src="manual.js" type="text/javascript"></script>
<script type="text/javascript">overwriteStyle();</script>
</head>
<body class="chap9"  onload="jscontent()">


<div class="chlinktop"><span class="chlink1">Goto Chapter: </span><a href="chap0.html">Top</a>  <a href="chap1.html">1</a>  <a href="chap2.html">2</a>  <a href="chap3.html">3</a>  <a href="chap4.html">4</a>  <a href="chap5.html">5</a>  <a href="chap6.html">6</a>  <a href="chap7.html">7</a>  <a href="chap8.html">8</a>  <a href="chap9.html">9</a>  <a href="chap10.html">10</a>  <a href=: </>

<div class="chlinkprevnexttop"> <a href="chap0.html">[Top of Book]</a>   <a href="chap0.html#contents">[Contents]</a>    <a href="chap8.html">[Previous Chapter]</a>    <a href="chap10.html">[Next Chapter]</a>   </div>

<p id="mathjaxlink" class="pcenter"><a href="chap9_mj.html">[MathJax on]</a></p>
<p><a id="X7A466B907B882CA0" name="X7A466B907B882CA0"></a></p>
<div class="ChapSects"><a href="chap9.html#X7A466B907B882CA0">9 <span class="Heading">I/O multiplexing</span></a>
<div classContSect< class=tocline< class"nocss"> </span href="chap9.html#X7DFB63A97E67C0A1">9.1 <spanclass"Heading"Introduction/pan/a>
<span>
</div>
<div class="ContSect"><span classa ="X7A466B907B882CA0"name=X7A466B907B882CA0/a>/>
</span>
<div class="ContSSBlock">
<span ="">< ="chap9.html#X7A466B907B882CA0">9 <pan="Heading">I/ </span/>
<span="ContSS>br/>nbsp;nbsp;/span>9.2-2 NewConnection
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap9.html#X8553D2E47C05797F">9.2-3 CloseConnection</a></span>
<spanclassContSSbr/<span="nocss"> nbspspan><a hrefchap9htmlX7F7FD824866CB58224AttachServingSocketa>/span
<span class"ontSS>
< /< ="ocss">nbsp</>a =chap9#">9.26 Shutdown
<span class="ContSS"><brspan ="ContSS>span ""&;&bsp.#7D1D9A8D837ECCEB9.2- NewConnection</a</pan
<span classContSSbr /<span class="nocss">nbsp;&bsp/pan<ahref"chap9html#X85F634D4826D89F1">92- SubmitOutputa><s>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap9.html#X837629707DF9B60E">9.2-9 GetInputspanclass="ContSS">br>span=nocss>&; <spana ="chap9.#X7F7FD824866CB582">.- AttachServingSocket<span
<span class="ContSS"><br /><span class="nocss"> <span="ContSS"><br /<span="nocss">nbsp;</span><a href"chap9html#X84AFBD658118ABB8">.2- Shutdown/></span
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap9.html#X7F8C7F5782213A71">9.2-11 OutputQueue</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap9.html#X7972FF1C7B59D0A4">9.2-12 InputQueue</a></span>
<span="ContSS">br/< class"nocss">  spanahrefhtmlX810D418A802D09D1">9.2-1 DoIO
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap9.html#X7A489A5D79DA9E5C">9.3 <span class="Heading"> Examples </span></a>
</span>
</div>
</div>

<h3>9 <span class="Heading">I/O multiplexing</span></h3>

<p><a id="X7DFB63A97E67C0A1" name="X7DFB63A97E67C0A1"></a></p>

<<spanclass"ContSS>
nocss>nbspnbsp/pana href"chap9.tml#X7F8C7F5782213A71"9.-1 OutputQueue/>

<p>Whenever one needs to doinput/output onmore one connection (file) at a time, some codeis neededto the I/multiplexing. Due to thesingle-threaded natureof the current <strong="pkg"></strong> language  hasto use<codeclass"> (
RefLink3.2-55</span</>)and bufferingqueueingtoorganisethis  chapter a relative  of/O-multiplexing using so-called <code class="func">IOHub</code> (< =".html#X83C0523D8538E866"><spanclassRefLink921<>< =func></> (< href".html#X83C0523D8538E866"> classRefLink>2-<span/> objecthandles of/O connectionsatsame and a bufferfor eachof.Thereavery   marks of called>messages/>) whenever   been completelyit collected thequeue  <codeclassfunc">IOHub/code> (< class="
RefLink">.-/a) markedwiththe number the it camefrom Ratherthansendinga away inonego one wouldalways schedule it sending byappendingittothe output queue. operation code class=func"DoIOcode ( ="hap9.htmlX810D418A802D09D1>">9.2-3/pan, when called enough, then make that the is sentawayeventually./pjava.lang.StringIndexOutOfBoundsException: Index 1561 out of bounds for length 1561

<p><a id="X81EC9A3186F1DCDE" name="X81EC9A3186F1DCDE"></a></p>

<h4>9.2 <span class="Heading">The operations for <code class="code">IOHub</code> objects</span></h4>

<p>In this section,

<p><a h4>.2span="">The for classcode>IOHub</code>objects></h4>

h521IOHub>

<div ="func"><table="func"="00"<>tdtdleft">code =func"&82;IOHub>  </d>td=tdright>(nbsp <tdtr>/tablediv
<

<p>This creates a new <code class="func">IOHub</codeobject at first without any open connections.</p>

<p><a id="X7D1D9A8D837ECCEB" name="X7D1D9A8D837ECCEB"></a></p>

<h5>9.2-2 NewConnection</h5>

<div class="func"><table class="func" width="100%"><tr><td
<>:  positive</p>

<div classfunctable="" width1%">tr>
, i< class="drightnbsp /d>/></><div

< the file registered <code=func</ode< =".html#"> class="">9.-1<spana) , everysubsequent callto < class=func></code> (ahref="hap9.html#X810D418A802D09D1"<span class"RefLink">92-3</span</>  try do  output themThis inthat other of connection shouldbe in same  of . Usually will achieved them addedasnew a <code=""><c> < =".htmlX83C0523D8538E866>< class="".-) onthe side at sametime



<p>See also <code class="func">NewTCPConnection</code> (<a href="chap9.html#X79031BC687502CB6"><span class="RefLink">9.2-10</span></a>) below.</p>

<p><a id="X8553D2E47C05797F" name="X8553D2E47C05797F"></a></p>

<h5>9.2-3 CloseConnection</h5>

<div class="func"><table class="func" width="100%"><tr><td <div class="func"><table class="func" width="100%"><tr><td class classfuncIOHub> (<a href=".X83C0523D8538E866">< class=""921/span>/a>) object, every subsequentcall  <code ="">DoIOcode> <ahrefchap9X< classRefLink>9213/span<a) try doand on them This in thatthe side thisconnection should inthe initial state  protocol Usually this be by being as new to a corresponding class=funcIOHubcode(<a href"chap9.#X83C0523D8538E866>< =RefLink>.21/) object on at thesame time./p>
<p>Returns: nothing</p>

<p>The argument <var class="Arg">h</var> must be an <code class="func">IOHub</code> (<a href="chap9.html#X83C0523D8538E866"><span

<p><a id="X7F7FD824866CB582" name="X7F7FD824866CB582"></a></p>

<h5>9.2-4 AttachServingSocket</h5>

<div class="func"><table class="func" widthpReturnsnothingpjava.lang.StringIndexOutOfBoundsException: Range [23, 24) out of bounds for length 23
p:aUnix or=keyw/><p

<p>The argument <var class="Arg">h</var> must be an <code class="func">IOHub</code> (<a href="chap9.html#X83C0523D8538E866"><span class="RefLink">9.2-1</span></a>) object, <var class="Arg">addr</var> an IP address or host name as a string and <var class="Arg">port</var> a port number (see also <code class="func">IO_MakeIPAddressPort</code> (<a href="chap4.html#X8568CE6684C90CE5"><span class="RefLink">4.3-6</span></a>)). This operation creates a new socket, binds it to the IP address and port and attaches it to the <code class="func">IOHub</code> (<a href="chap9.html#X83C0523D8538E866"><span class="RefLink">9.2-1</span></a>) object. From this moment on the operation <code class

<p><a id="X7866F9DA8358968C" name="X7866F9DA8358968C"></a></p>

<h5>9.2-5 ShutdownServingSocket</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ ShutdownServingSocket</code>( <var class="Arg">h</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>Returns: nothing</p>

<p>The argument <var class="Arg">h</var> must be an <code class="func">IOHub</code> (<a href="chap9.html#X83C0523D8538E866"><span class="RefLink">9.2-1</span></a>) object. Any server socket which was attached to <var class="Arg">h</var> is shut down, so no new connections will be accepted.</p>

<p><a id="X84AFBD658118ABB8" name="X84AFBD658118ABB8"></a></p>

<h5>9.2-6 Shutdown</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ Shutdown</code>( <var class="Arg">h</var> )</td><td class="tdright">( operation )</td></tr></table></div
<p>Returns: nothing</p>

<p>The argument <var class="Arg">h</var> must be an <code class="func">IOHub</code> (<a href="chap9.html#X83C0523D8538E866"><span class="RefLink">9.2-1</span></a>) object. All connections of <var class="Arg">h</var> will be closed using <code class="func">CloseConnection</code> (<a href="chap9.html#X8553D2E47C05797F"><span class="RefLink">9.2-3</span></a>) and any serving socket will be shut down using <code class="func">ShutdownServingSocket</code> (<a href="chap9.html#X7866F9DA8358968C"><span class="RefLink">9.2-5</span></a>). The <code class="func">IOHub</code> (<a href="chap9.html<>: nothing

<p><a id="X7BE1B9FD82C9B8E0" name="X7BE1B9FD82C9B8E0"></a></p>

<h5>9.2-7 AcceptNewConnection

v="func">table="func" ="10%>tr>td class="tdleft">func#27 AcceptNewConnectioncode var="">h</var> )/td>td="tdright"(nbsp tdtr><div
<p>eturnsa positiveintegeror <code class="keyw"failcode<p>

<p>The argument <var class="Arg">h</var> must be an <code class="func">IOHub</code> (<a href="chap9.html#X83C0523D8538E866"><span class="RefLink">9.2-1</span></<>: positive  <codeclasskeyw<codep

<p><a id="X85F634D4826D89F1" name="X85F634D4826D89F1"></a></p>

<h5>9.2-8 SubmitOutput</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ SubmitOutput</code>( <var class="Arg">h</var>, <var class="Arg">nr</var>, <var class="Arg">st</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>Returns: <code class="keyw">true</code> or <code class="keyw">fail</code></p>

<p>The argument <var class="Arg">h</var> must be an <code class="func">IOHub</code> (<a href="chap9.html#X83C0523D8538E866"><span class="RefLink">9.2-1</span></a>) object, <var class="Arg">nr</varmust be a positive integer which is the number of an open connection of <var class="Arg">h</var> which can be used for output. The argument <var class="Arg">st</var> must be a <strong class="pkg">GAP</strong> string. This operation appends the message <var class="Arg">st</var> to the end of the output queue for the connection <var class="Arg">nr</var>. Note that

<p><a id="X837629707DF9B60E" name="X837629707DF9B60E"></a></p>

<h5>9.2-9 GetInput</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ GetInput</code>( <var class="Arg">h</var>, <var class="Arg">nr</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>Returns: a list of length <span class="SimpleMath">2</span></p>

<p>The argument <var class="Arg">h</var> must be an <code class="func">IOHub</code> (<a href="chap9.html#X83C0523D8538E866"><span class="RefLink">9.2-1</span></a>) object, <var class="Arg">nr</varmust be an integer. If <var class="Arg">nr</var> is positive, this operation returns the earliest message which has come in from connection number <var class="Arg">nr</var> and has not yet been returned by <code class="func">GetInput</code> before. This message is then removed from the input queue. If there is no such message, then <code class="keyw">false</code> is returned. A message is returned as a plain list of length <span class="SimpleMath">2</span> where the first entry is the connection number it came from and the second entry is 

<p><a id="X79031BC687502CB6" name="X79031BC687502CB6"></a></p>

<h5>9.2-10 NewTCPConnection</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ NewTCPConnection</code>( <var class="Arg">h</var>, <var class="Arg">addr</var>, <var class="Arg">port</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<Returns connection or<code="keyw"failcode<p>

<p>The argument <var class="Arg">h</var> must <p>Returns a connectionnumber or <code class"eyw>fail
/p


<p><a id="X7F8C7F5782213A71" name="X7F8C7F5782213A71"></a></p>

<h5>.-1OutputQueue>

<div< ="">< class"width10%>

#27;">h )/td>tdright(nbspnbsp)/d<tr><div
<p>Returns:>Returns: </p>

<p>The>The < class"">h/>  be <code class">OHub/> ( name="X7972FF1C7B59D0A4"></a></p>

<h5>9.2-12 InputQueue</h5

<div class
<>: alist

<> argument< class">h be an ">IOHub (a ="chap9html#">9.2-1/span> returns internal object for theinputqueue. elements are where the first is the connectionnumber from where the message was receivedand the secondentry the message as a string Only modify thislist if you know what you are .

<p><a id="X810D418A802D09D1" name="X810D418A802D09D1"></a></p>

<h5>9.2-13 DoIO</h5>

<div ="func"< =func"00>tr< class="">h/>[ ">block]
< ="tdrightnbsp;</d<trtable>
<p>Returns: <code class="keyw">true</code> or <code class="keyw">false</code> or <code class="keyw">fail</code></p>

<p>The argument <var class="Arg">

<p>Note that broken connections are silently closed.</p>

<p>aidX7A489A5D79DA9E5Cname>/>/p>

<h4>9.3 <span class="Heading"> Examples </spandiv="func"<table="func" width10"<>
">R DoIOhtdclass"tdright;&;)<></tr/table>

<p>There is an example hash server in the file <code class="file">examples/hashserver.g</code>.</p>


<div class="chlinkprevnextbot"> <a href="chap0.html">[Top of Book]</a>   <a href="chap0.html#contents">[Contents]</a>    <a href="chap8.html">[Previous Chapter]</a>    <a href="chap10.html">[Next Chapter]</a>   <java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0


<div class="chlinkbot"><span class="chlink1">Goto Chapter:java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

<hr />
<p class="foot">generated by <a href="https://www.math.rwth-aachen.de/~Frank.Luebeck/GAPDoc">GAPDoc2HTML</a></p>
</body>
</html>

96%


¤ Dauer der Verarbeitung: 0.15 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung ist noch experimentell.