📄 classchannel__c.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>channel_c class Reference</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.2.18 --><center><a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> </center><hr><h1>channel_c Class Reference</h1>a wrapper to a connected NL TCP socket, created by and associated to a <a class="el" href="classzigclient__c.html">zigclient_c</a> or <a class="el" href="classzigserver__c.html">zigserver_c</a> (you will not instantiate this class yourself) <a href="#_details">More...</a><p><code>#include <<a class="el" href="channel_8h-source.html">channel.h</a>></code><p><a href="classchannel__c-members.html">List of all members.</a><table border=0 cellpadding=0 cellspacing=0><tr><td></td></tr><tr><td colspan=2><br><h2>Public Methods</h2></td></tr><tr><td nowrap align=right valign=top><a name="a2" doxytag="channel_c::set_keep_open"></a>void </td><td valign=bottom><a class="el" href="classchannel__c.html#a2">set_keep_open</a> (bool val)</td></tr><tr><td> </td><td><font size=-1><em>set "keep open when reader exits" flag</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a3" doxytag="channel_c::get_keep_open"></a>bool </td><td valign=bottom><a class="el" href="classchannel__c.html#a3">get_keep_open</a> ()</td></tr><tr><td> </td><td><font size=-1><em>get "keep open when reader exits" flag</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a7" doxytag="channel_c::write"></a>int </td><td valign=bottom><a class="el" href="classchannel__c.html#a7">write</a> (<a class="el" href="classbuffer__c.html">buffer_c</a> &out, bool timeout_is_failure=true, double timeout=3.0)</td></tr><tr><td> </td><td><font size=-1><em>send an amount of bytes. returns result of nlWrite() which is equal to the size of the bufferif everything goes ok, NL_INVALID if a fatal error occurs, or [0..buffer size - 1] if couldn'tdeliver all data before the timeout was reached. "timeout" is the timeout, in seconds, toautomatically keep trying to send the buffer (sometimes the TCP buffers get full and we needto call nlWrite() more than once to send all stuff)if timeout_is_failure == true, then this method closes the socket and returns NL_INVALID if,after the timeout is reached, not all data was delivered sucessfully.</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a8" doxytag="channel_c::read"></a>int </td><td valign=bottom><a class="el" href="classchannel__c.html#a8">read</a> (<a class="el" href="classbuffer__c.html">buffer_c</a> &in, int size)</td></tr><tr><td> </td><td><font size=-1><em>receive an amount of bytes. blocking call. returns result of nlRead()</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a9" doxytag="channel_c::read_string"></a>int </td><td valign=bottom><a class="el" href="classchannel__c.html#a9">read_string</a> (std::string &str, int maxsize=-1)</td></tr><tr><td> </td><td><font size=-1><em>special receive operation: read a zero-terminated string up to a givensize. returns result of the last nlRead() performed by the function(will be an error code (== NL_INVALID == -1), or 1 if sucessful).returns 0 if the maximum size was reached without reading a \0 from thestream (this may actually be what you want)if maxsize == -1, then will read forever until the \0 is reached.</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a10" doxytag="channel_c::close"></a>void </td><td valign=bottom><a class="el" href="classchannel__c.html#a10">close</a> ()</td></tr><tr><td> </td><td><font size=-1><em>close this channel; WARNING: for the time being, DO NOT call this function from inside your channel readers (your <a class="el" href="classzigserver__c.html">zigserver_c</a>:: or zigclient::channel_opened() implementations) or the program will deadlock; just let the channel method exit and the channel will close itself (provided you didn't call keep_open(true) for this channel, in which case you will have to call <a class="el" href="classchannel__c.html#a10">close()</a> for this channel explicitly from another thread)</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a11" doxytag="channel_c::is_closed"></a>bool </td><td valign=bottom><a class="el" href="classchannel__c.html#a11">is_closed</a> ()</td></tr><tr><td> </td><td><font size=-1><em>this channel is closed?</em></font><br><br></td></tr></table><hr><a name="_details"></a><h2>Detailed Description</h2>a wrapper to a connected NL TCP socket, created by and associated to a <a class="el" href="classzigclient__c.html">zigclient_c</a> or <a class="el" href="classzigserver__c.html">zigserver_c</a> (you will not instantiate this class yourself)<p><hr>The documentation for this class was generated from the following files:<ul><li><a class="el" href="channel_8h-source.html">channel.h</a><li>channel.cpp</ul><hr><address style="align: right;"><small>Generated on Mon Jan 24 21:14:23 2005 for ZIG by<a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border=0 width=110 height=53></a>1.2.18 </small></address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -