1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232
|
<!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">
<head>
<title>Class Poco::Net::DialogSocket</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta name="author" content="Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="publisher" content="Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="copyright" content="Copyright (c) 2009, Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="language" content="en"/>
<meta name="date" content="2009-11-24"/>
<meta name="generator" content="PocoDoc"/>
<link rel="stylesheet" href="css/styles.css" type="text/css"/>
</head>
<body bgcolor="#ffffff" leftmargin="0" topmargin="0">
<div class="header">
<h1 class="namespace"><a href="Poco.Net.html" class="namespace">Poco::Net</a></h1>
<h1 class="symbol">class DialogSocket</h1>
</div>
<div class="body">
<p>
<b>Library:</b> Net<br />
<b>Package:</b> Sockets<br />
<b>Header:</b> Poco/Net/DialogSocket.h</p>
<h2>Description</h2>
<div class="description">
<p><a href="Poco.Net.DialogSocket.html" title="class Poco::Net::DialogSocket">DialogSocket</a> is a subclass of <a href="Poco.Net.StreamSocket.html" title="class Poco::Net::StreamSocket">StreamSocket</a> that can be used for implementing request-response based client server connections. </p>
<p>A request is always a single-line command terminated by CR-LF. </p>
<p>A response can either be a single line of text terminated by CR-LF, or multiple lines of text in the format used by the FTP and SMTP protocols. </p>
<p>Limited support for the TELNET protocol (<a href="http://www.ietf.org/rfc/rfc854.txt" target="_blank">RFC 854</a>) is available. </p>
</div>
<h2>Inheritance</h2>
<p><b>Direct Base Classes: </b><a href="Poco.Net.StreamSocket.html" title="class Poco::Net::StreamSocket">StreamSocket</a></p>
<p><b>All Base Classes: </b><a href="Poco.Net.Socket.html" title="class Poco::Net::Socket">Socket</a>, <a href="Poco.Net.StreamSocket.html" title="class Poco::Net::StreamSocket">StreamSocket</a></p>
<h2>Member Summary</h2>
<p><b>Member Functions: </b><a href="Poco.Net.DialogSocket.html#12240" title="Poco::Net::DialogSocket::allocBuffer()">allocBuffer</a>, <a href="Poco.Net.DialogSocket.html#12215" title="Poco::Net::DialogSocket::get()">get</a>, <a href="Poco.Net.DialogSocket.html#12194" title="Poco::Net::DialogSocket::operator =()">operator =</a>, <a href="Poco.Net.DialogSocket.html#12216" title="Poco::Net::DialogSocket::peek()">peek</a>, <a href="Poco.Net.DialogSocket.html#12242" title="Poco::Net::DialogSocket::receiveLine()">receiveLine</a>, <a href="Poco.Net.DialogSocket.html#12211" title="Poco::Net::DialogSocket::receiveMessage()">receiveMessage</a>, <a href="Poco.Net.DialogSocket.html#12244" title="Poco::Net::DialogSocket::receiveStatusLine()">receiveStatusLine</a>, <a href="Poco.Net.DialogSocket.html#12213" title="Poco::Net::DialogSocket::receiveStatusMessage()">receiveStatusMessage</a>, <a href="Poco.Net.DialogSocket.html#12241" title="Poco::Net::DialogSocket::refill()">refill</a>, <a href="Poco.Net.DialogSocket.html#12196" title="Poco::Net::DialogSocket::sendByte()">sendByte</a>, <a href="Poco.Net.DialogSocket.html#12202" title="Poco::Net::DialogSocket::sendMessage()">sendMessage</a>, <a href="Poco.Net.DialogSocket.html#12198" title="Poco::Net::DialogSocket::sendString()">sendString</a>, <a href="Poco.Net.DialogSocket.html#12218" title="Poco::Net::DialogSocket::sendTelnetCommand()">sendTelnetCommand</a>, <a href="Poco.Net.DialogSocket.html#12217" title="Poco::Net::DialogSocket::synch()">synch</a></p>
<p><b>Inherited Functions: </b><a href="Poco.Net.Socket.html#15077" title="Poco::Net::Socket::address()">address</a>, <a href="Poco.Net.Socket.html#15000" title="Poco::Net::Socket::available()">available</a>, <a href="Poco.Net.Socket.html#14991" title="Poco::Net::Socket::close()">close</a>, <a href="Poco.Net.StreamSocket.html#15497" title="Poco::Net::StreamSocket::connect()">connect</a>, <a href="Poco.Net.StreamSocket.html#15502" title="Poco::Net::StreamSocket::connectNB()">connectNB</a>, <a href="Poco.Net.Socket.html#15076" title="Poco::Net::Socket::getBlocking()">getBlocking</a>, <a href="Poco.Net.Socket.html#15064" title="Poco::Net::Socket::getKeepAlive()">getKeepAlive</a>, <a href="Poco.Net.Socket.html#15056" title="Poco::Net::Socket::getLinger()">getLinger</a>, <a href="Poco.Net.Socket.html#15061" title="Poco::Net::Socket::getNoDelay()">getNoDelay</a>, <a href="Poco.Net.Socket.html#15073" title="Poco::Net::Socket::getOOBInline()">getOOBInline</a>, <a href="Poco.Net.Socket.html#15033" title="Poco::Net::Socket::getOption()">getOption</a>, <a href="Poco.Net.Socket.html#15006" title="Poco::Net::Socket::getReceiveBufferSize()">getReceiveBufferSize</a>, <a href="Poco.Net.Socket.html#15012" title="Poco::Net::Socket::getReceiveTimeout()">getReceiveTimeout</a>, <a href="Poco.Net.Socket.html#15067" title="Poco::Net::Socket::getReuseAddress()">getReuseAddress</a>, <a href="Poco.Net.Socket.html#15070" title="Poco::Net::Socket::getReusePort()">getReusePort</a>, <a href="Poco.Net.Socket.html#15003" title="Poco::Net::Socket::getSendBufferSize()">getSendBufferSize</a>, <a href="Poco.Net.Socket.html#15009" title="Poco::Net::Socket::getSendTimeout()">getSendTimeout</a>, <a href="Poco.Net.Socket.html#15079" title="Poco::Net::Socket::impl()">impl</a>, <a href="Poco.Net.Socket.html#14981" title="Poco::Net::Socket::operator !=()">operator !=</a>, <a href="Poco.Net.Socket.html#14983" title="Poco::Net::Socket::operator <()">operator <</a>, <a href="Poco.Net.Socket.html#14985" title="Poco::Net::Socket::operator <=()">operator <=</a>, <a href="Poco.Net.Socket.html#14976" title="Poco::Net::Socket::operator =()">operator =</a>, <a href="Poco.Net.Socket.html#14979" title="Poco::Net::Socket::operator ==()">operator ==</a>, <a href="Poco.Net.Socket.html#14987" title="Poco::Net::Socket::operator >()">operator ></a>, <a href="Poco.Net.Socket.html#14989" title="Poco::Net::Socket::operator >=()">operator >=</a>, <a href="Poco.Net.Socket.html#15078" title="Poco::Net::Socket::peerAddress()">peerAddress</a>, <a href="Poco.Net.Socket.html#14997" title="Poco::Net::Socket::poll()">poll</a>, <a href="Poco.Net.StreamSocket.html#15511" title="Poco::Net::StreamSocket::receiveBytes()">receiveBytes</a>, <a href="Poco.Net.Socket.html#14992" title="Poco::Net::Socket::select()">select</a>, <a href="Poco.Net.StreamSocket.html#15507" title="Poco::Net::StreamSocket::sendBytes()">sendBytes</a>, <a href="Poco.Net.StreamSocket.html#15515" title="Poco::Net::StreamSocket::sendUrgent()">sendUrgent</a>, <a href="Poco.Net.Socket.html#15074" title="Poco::Net::Socket::setBlocking()">setBlocking</a>, <a href="Poco.Net.Socket.html#15062" title="Poco::Net::Socket::setKeepAlive()">setKeepAlive</a>, <a href="Poco.Net.Socket.html#15053" title="Poco::Net::Socket::setLinger()">setLinger</a>, <a href="Poco.Net.Socket.html#15059" title="Poco::Net::Socket::setNoDelay()">setNoDelay</a>, <a href="Poco.Net.Socket.html#15071" title="Poco::Net::Socket::setOOBInline()">setOOBInline</a>, <a href="Poco.Net.Socket.html#15013" title="Poco::Net::Socket::setOption()">setOption</a>, <a href="Poco.Net.Socket.html#15004" title="Poco::Net::Socket::setReceiveBufferSize()">setReceiveBufferSize</a>, <a href="Poco.Net.Socket.html#15010" title="Poco::Net::Socket::setReceiveTimeout()">setReceiveTimeout</a>, <a href="Poco.Net.Socket.html#15065" title="Poco::Net::Socket::setReuseAddress()">setReuseAddress</a>, <a href="Poco.Net.Socket.html#15068" title="Poco::Net::Socket::setReusePort()">setReusePort</a>, <a href="Poco.Net.Socket.html#15001" title="Poco::Net::Socket::setSendBufferSize()">setSendBufferSize</a>, <a href="Poco.Net.Socket.html#15007" title="Poco::Net::Socket::setSendTimeout()">setSendTimeout</a>, <a href="Poco.Net.StreamSocket.html#15506" title="Poco::Net::StreamSocket::shutdown()">shutdown</a>, <a href="Poco.Net.StreamSocket.html#15504" title="Poco::Net::StreamSocket::shutdownReceive()">shutdownReceive</a>, <a href="Poco.Net.StreamSocket.html#15505" title="Poco::Net::StreamSocket::shutdownSend()">shutdownSend</a>, <a href="Poco.Net.Socket.html#15084" title="Poco::Net::Socket::sockfd()">sockfd</a>, <a href="Poco.Net.Socket.html#15080" title="Poco::Net::Socket::supportsIPv4()">supportsIPv4</a>, <a href="Poco.Net.Socket.html#15081" title="Poco::Net::Socket::supportsIPv6()">supportsIPv6</a></p>
<h2>Enumerations</h2>
<h3><a name="12223">TelnetCodes</a></h3>
<div class="description">
<p></p>
</div>
<p class="decl"><a name="12224">TELNET_SE</a> = 240</p>
<div class="description">
<p></p>
</div>
<p class="decl"><a name="12225">TELNET_NOP</a> = 241</p>
<div class="description">
<p></p>
</div>
<p class="decl"><a name="12226">TELNET_DM</a> = 242</p>
<div class="description">
<p></p>
</div>
<p class="decl"><a name="12227">TELNET_BRK</a> = 243</p>
<div class="description">
<p></p>
</div>
<p class="decl"><a name="12228">TELNET_IP</a> = 244</p>
<div class="description">
<p></p>
</div>
<p class="decl"><a name="12229">TELNET_AO</a> = 245</p>
<div class="description">
<p></p>
</div>
<p class="decl"><a name="12230">TELNET_AYT</a> = 246</p>
<div class="description">
<p></p>
</div>
<p class="decl"><a name="12231">TELNET_EC</a> = 247</p>
<div class="description">
<p></p>
</div>
<p class="decl"><a name="12232">TELNET_EL</a> = 248</p>
<div class="description">
<p></p>
</div>
<p class="decl"><a name="12233">TELNET_GA</a> = 249</p>
<div class="description">
<p></p>
</div>
<p class="decl"><a name="12234">TELNET_SB</a> = 250</p>
<div class="description">
<p></p>
</div>
<p class="decl"><a name="12235">TELNET_WILL</a> = 251</p>
<div class="description">
<p></p>
</div>
<p class="decl"><a name="12236">TELNET_WONT</a> = 252</p>
<div class="description">
<p></p>
</div>
<p class="decl"><a name="12237">TELNET_DO</a> = 253</p>
<div class="description">
<p></p>
</div>
<p class="decl"><a name="12238">TELNET_DONT</a> = 254</p>
<div class="description">
<p></p>
</div>
<p class="decl"><a name="12239">TELNET_IAC</a> = 255</p>
<div class="description">
<p></p>
</div>
<h2>Constructors</h2>
<h3><a name="12188">DialogSocket</a></h3>
<p class="decl"><a href="Poco.Net.DialogSocket.html" title="class Poco::Net::DialogSocket">DialogSocket</a>();</p>
<div class="description">
<p>Creates an unconnected stream socket. </p>
<p>Before sending or receiving data, the socket must be connected with a call to connect(). </p>
</div>
<h3><a name="12189">DialogSocket</a></h3>
<p class="decl">explicit <a href="Poco.Net.DialogSocket.html" title="class Poco::Net::DialogSocket">DialogSocket</a>(<br /> const <a href="Poco.Net.SocketAddress.html" title="class Poco::Net::SocketAddress">SocketAddress</a> & address<br />);</p>
<div class="description">
<p>Creates a stream socket and connects it to the socket specified by address. </p>
</div>
<h3><a name="12191">DialogSocket</a></h3>
<p class="decl"><a href="Poco.Net.DialogSocket.html" title="class Poco::Net::DialogSocket">DialogSocket</a>(<br /> const <a href="Poco.Net.Socket.html" title="class Poco::Net::Socket">Socket</a> & socket<br />);</p>
<div class="description">
<p>Creates the <a href="Poco.Net.DialogSocket.html" title="class Poco::Net::DialogSocket">DialogSocket</a> with the <a href="Poco.Net.SocketImpl.html" title="class Poco::Net::SocketImpl">SocketImpl</a> from another socket. The <a href="Poco.Net.SocketImpl.html" title="class Poco::Net::SocketImpl">SocketImpl</a> must be a <a href="Poco.Net.StreamSocketImpl.html" title="class Poco::Net::StreamSocketImpl">StreamSocketImpl</a>, otherwise an <a href="Poco.InvalidArgumentException.html" title="class Poco::InvalidArgumentException">InvalidArgumentException</a> will be thrown. </p>
</div>
<h2>Destructor</h2>
<h3><a name="12193">~DialogSocket</a> <img src="images/virtual.gif" alt="virtual" title="virtual" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">~<a href="Poco.Net.DialogSocket.html" title="class Poco::Net::DialogSocket">DialogSocket</a>();</p>
<div class="description">
<p>Destroys the <a href="Poco.Net.DialogSocket.html" title="class Poco::Net::DialogSocket">DialogSocket</a>. </p>
</div>
<h2>Member Functions</h2>
<h3><a name="12215">get</a></h3>
<p class="decl">int get();</p>
<div class="description">
<p>Reads one character from the connection. </p>
<p>Returns -1 (<a href="Poco.Net.DialogSocket.html#12248" title="Poco::Net::DialogSocket::EOF_CHAR">EOF_CHAR</a>) if no more characters are available. </p>
</div>
<h3><a name="12194">operator =</a></h3>
<p class="decl"><a href="Poco.Net.DialogSocket.html" title="class Poco::Net::DialogSocket">DialogSocket</a> & operator = (<br /> const <a href="Poco.Net.Socket.html" title="class Poco::Net::Socket">Socket</a> & socket<br />);</p>
<div class="description">
<p>Assignment operator. </p>
<p>Releases the socket's <a href="Poco.Net.SocketImpl.html" title="class Poco::Net::SocketImpl">SocketImpl</a> and attaches the <a href="Poco.Net.SocketImpl.html" title="class Poco::Net::SocketImpl">SocketImpl</a> from the other socket and increments the reference count of the <a href="Poco.Net.SocketImpl.html" title="class Poco::Net::SocketImpl">SocketImpl</a>. </p>
</div>
<h3><a name="12216">peek</a></h3>
<p class="decl">int peek();</p>
<div class="description">
<p>Returns the character that would be returned by the next call to <a href="Poco.Net.DialogSocket.html#12215" title="Poco::Net::DialogSocket::get()">get</a>(), without actually extracting the character from the buffer. </p>
<p>Returns -1 (<a href="Poco.Net.DialogSocket.html#12248" title="Poco::Net::DialogSocket::EOF_CHAR">EOF_CHAR</a>) if no more characters are available. </p>
</div>
<h3><a name="12211">receiveMessage</a></h3>
<p class="decl">bool receiveMessage(<br /> std::string & message<br />);</p>
<div class="description">
<p>Receives a single-line message, terminated by CR-LF, from the socket connection and appends it to response. </p>
<p>Returns true if a message has been read or false if the connection has been closed by the peer. </p>
</div>
<h3><a name="12213">receiveStatusMessage</a></h3>
<p class="decl">int receiveStatusMessage(<br /> std::string & message<br />);</p>
<div class="description">
<p>Receives a single-line or multi-line response from the socket connection. The format must be according to one of the response formats specified in the FTP (<a href="http://www.ietf.org/rfc/rfc959.txt" target="_blank">RFC 959</a>) or SMTP (<a href="http://www.ietf.org/rfc/rfc2821.txt" target="_blank">RFC 2821</a>) specifications. </p>
<p>The first line starts with a 3-digit status code. Following the status code is either a space character (' ' ) (in case of a single-line response) or a minus character ('-') in case of a multi-line response. The following lines can have a three-digit status code followed by a minus-sign and some text, or some arbitrary text only. The last line again begins with a three-digit status code (which must be the same as the one in the first line), followed by a space and some arbitrary text. All lines must be terminated by a CR-LF sequence. </p>
<p>The response contains all response lines, separated by a newline character, including the status code. The status code is returned. If the response line does not contain a status code, 0 is returned. </p>
</div>
<h3><a name="12196">sendByte</a></h3>
<p class="decl">void sendByte(<br /> unsigned char ch<br />);</p>
<div class="description">
<p>Sends a single byte over the socket connection. </p>
</div>
<h3><a name="12202">sendMessage</a></h3>
<p class="decl">void sendMessage(<br /> const std::string & message<br />);</p>
<div class="description">
<p>Appends a CR-LF sequence to the message and sends it over the socket connection. </p>
</div>
<h3><a name="12204">sendMessage</a></h3>
<p class="decl">void sendMessage(<br /> const std::string & message,<br /> const std::string & arg<br />);</p>
<div class="description">
<p>Concatenates message and arg, separated by a space, appends a CR-LF sequence, and sends the result over the socket connection. </p>
</div>
<h3><a name="12207">sendMessage</a></h3>
<p class="decl">void sendMessage(<br /> const std::string & message,<br /> const std::string & arg1,<br /> const std::string & arg2<br />);</p>
<div class="description">
<p>Concatenates message and args, separated by a space, appends a CR-LF sequence, and sends the result over the socket connection. </p>
</div>
<h3><a name="12198">sendString</a></h3>
<p class="decl">void sendString(<br /> const char * str<br />);</p>
<div class="description">
<p>Sends the given null-terminated string over the socket connection. </p>
</div>
<h3><a name="12200">sendString</a></h3>
<p class="decl">void sendString(<br /> const std::string & str<br />);</p>
<div class="description">
<p>Sends the given string over the socket connection. </p>
</div>
<h3><a name="12218">sendTelnetCommand</a></h3>
<p class="decl">void sendTelnetCommand(<br /> unsigned char command<br />);</p>
<div class="description">
<p>Sends a TELNET command sequence (<a href="Poco.Net.DialogSocket.html#12239" title="Poco::Net::DialogSocket::TELNET_IAC">TELNET_IAC</a> followed by the given command) over the connection. </p>
</div>
<h3><a name="12220">sendTelnetCommand</a></h3>
<p class="decl">void sendTelnetCommand(<br /> unsigned char command,<br /> unsigned char arg<br />);</p>
<div class="description">
<p>Sends a TELNET command sequence (<a href="Poco.Net.DialogSocket.html#12239" title="Poco::Net::DialogSocket::TELNET_IAC">TELNET_IAC</a> followed by the given command, followed by arg) over the connection. </p>
</div>
<h3><a name="12217">synch</a></h3>
<p class="decl">void synch();</p>
<div class="description">
<p>Sends a TELNET SYNCH signal over the connection. </p>
<p>According to <a href="http://www.ietf.org/rfc/rfc854.txt" target="_blank">RFC 854</a>, a <a href="Poco.Net.DialogSocket.html#12226" title="Poco::Net::DialogSocket::TELNET_DM">TELNET_DM</a> char is sent via sendUrgent(). </p>
</div>
<h3><a name="12240">allocBuffer</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">void allocBuffer();</p>
<div class="description">
<p></p>
</div>
<h3><a name="12242">receiveLine</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">bool receiveLine(<br /> std::string & line<br />);</p>
<div class="description">
<p></p>
</div>
<h3><a name="12244">receiveStatusLine</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">int receiveStatusLine(<br /> std::string & line<br />);</p>
<div class="description">
<p></p>
</div>
<h3><a name="12241">refill</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">void refill();</p>
<div class="description">
<p></p>
</div>
<p class="footer">POCO C++ Libraries 1.3.6-all<br />
Copyright © 2009, <a href="http://pocoproject.org/" target="_blank">Applied Informatics Software Engineering GmbH and Contributors</a></p>
</div>
</body>
</html>
|