| 1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> |
| 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 3 | <html xmlns="http://www.w3.org/1999/xhtml"> |
| 4 | <head> |
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
| 6 | <title>DbChannel::send_request()</title> |
| 7 | <link rel="stylesheet" href="apiReference.css" type="text/css" /> |
| 8 | <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /> |
| 9 | <link rel="start" href="index.html" title="Berkeley DB C++ API Reference" /> |
| 10 | <link rel="up" href="rep.html" title="Chapter 11. Replication Methods" /> |
| 11 | <link rel="prev" href="dbchannel_send_msg.html" title="DbChannel::send_msg()" /> |
| 12 | <link rel="next" href="dbchannel_set_timeout.html" title="DbChannel::set_timeout()" /> |
| 13 | </head> |
| 14 | <body> |
| 15 | <div xmlns="" class="navheader"> |
| 16 | <div class="libver"> |
| 17 | <p>Library Version 11.2.5.3</p> |
| 18 | </div> |
| 19 | <table width="100%" summary="Navigation header"> |
| 20 | <tr> |
| 21 | <th colspan="3" align="center">DbChannel::send_request()</th> |
| 22 | </tr> |
| 23 | <tr> |
| 24 | <td width="20%" align="left"><a accesskey="p" href="dbchannel_send_msg.html">Prev</a> </td> |
| 25 | <th width="60%" align="center">Chapter 11. |
| 26 | Replication Methods |
| 27 | </th> |
| 28 | <td width="20%" align="right"> <a accesskey="n" href="dbchannel_set_timeout.html">Next</a></td> |
| 29 | </tr> |
| 30 | </table> |
| 31 | <hr /> |
| 32 | </div> |
| 33 | <div class="sect1" lang="en" xml:lang="en"> |
| 34 | <div class="titlepage"> |
| 35 | <div> |
| 36 | <div> |
| 37 | <h2 class="title" style="clear: both"><a id="dbchannel_send_request"></a>DbChannel::send_request()</h2> |
| 38 | </div> |
| 39 | </div> |
| 40 | </div> |
| 41 | <pre class="programlisting">#include <db_cxx.h> |
| 42 | |
| 43 | int |
| 44 | DbChannel::send_request(Dbt *request, u_int32_t nrequest, |
| 45 | Dbt *response, db_timeout_t timeout, |
| 46 | u_int32_t flags);</pre> |
| 47 | <p> |
| 48 | The <code class="methodname">DbChannel::send_request()</code> method |
| 49 | sends a message on the message channel. The message is sent |
| 50 | synchronously; the method blocks waiting for a response before |
| 51 | returning. If a response is not received within the timeout value |
| 52 | configured for this request, this method returns with an error |
| 53 | condition. |
| 54 | </p> |
| 55 | <p> |
| 56 | If you do not want to block while waiting for a response from a remote |
| 57 | site, use the |
| 58 | <a class="xref" href="dbchannel_send_msg.html" title="DbChannel::send_msg()">DbChannel::send_msg()</a> |
| 59 | method. |
| 60 | </p> |
| 61 | <p> |
| 62 | The message sent by this method is received and handled at |
| 63 | remote sites using a message dispatch callback, which is configured |
| 64 | using the <a class="xref" href="repmgr_msg_dispatch.html" title="DbEnv::repmgr_msg_dispatch()">DbEnv::repmgr_msg_dispatch()</a> |
| 65 | method. |
| 66 | </p> |
| 67 | <p> |
| 68 | The <code class="methodname">DbChannel::send_request()</code> <span> |
| 69 | |
| 70 | <span> |
| 71 | method either returns a non-zero error value or throws an |
| 72 | exception that encapsulates a non-zero error value on |
| 73 | failure, and returns 0 on success. |
| 74 | </span> |
| 75 | </span> |
| 76 | </p> |
| 77 | <div class="sect2" lang="en" xml:lang="en"> |
| 78 | <div class="titlepage"> |
| 79 | <div> |
| 80 | <div> |
| 81 | <h3 class="title"><a id="idp9344800"></a>Parameters</h3> |
| 82 | </div> |
| 83 | </div> |
| 84 | </div> |
| 85 | <div class="sect3" lang="en" xml:lang="en"> |
| 86 | <div class="titlepage"> |
| 87 | <div> |
| 88 | <div> |
| 89 | <h4 class="title"><a id="idp9345184"></a>request</h4> |
| 90 | </div> |
| 91 | </div> |
| 92 | </div> |
| 93 | <p> |
| 94 | Refers to an array of Dbt handles. For more |
| 95 | information, see |
| 96 | <a class="xref" href="dbt.html" title="Chapter 4. The Dbt Handle"> |
| 97 | The Dbt Handle |
| 98 | </a>. |
| 99 | </p> |
| 100 | <p> |
| 101 | Any flags provided to the Dbt handles used in this |
| 102 | array are ignored. |
| 103 | </p> |
| 104 | </div> |
| 105 | <div class="sect3" lang="en" xml:lang="en"> |
| 106 | <div class="titlepage"> |
| 107 | <div> |
| 108 | <div> |
| 109 | <h4 class="title"><a id="idp9340936"></a>nrequest</h4> |
| 110 | </div> |
| 111 | </div> |
| 112 | </div> |
| 113 | <p> |
| 114 | Indicates how many elements are contained in the |
| 115 | <code class="literal">msg</code> array. |
| 116 | </p> |
| 117 | </div> |
| 118 | <div class="sect3" lang="en" xml:lang="en"> |
| 119 | <div class="titlepage"> |
| 120 | <div> |
| 121 | <div> |
| 122 | <h4 class="title"><a id="idp9344040"></a>response</h4> |
| 123 | </div> |
| 124 | </div> |
| 125 | </div> |
| 126 | <p> |
| 127 | Points to a single Dbt handle, which is used to |
| 128 | receive the response from the remote site. By default, the |
| 129 | response is expected to be a single-part message. If |
| 130 | there is a possibility that the response could be a |
| 131 | multi-part message, specify <code class="literal">DB_MULTIPLE</code> |
| 132 | to this method's <span class="bold"><strong>flags</strong></span> |
| 133 | parameter. |
| 134 | </p> |
| 135 | <p> |
| 136 | The response Dbt should specify one of the |
| 137 | following flags: |
| 138 | <code class="literal">DB_DBT_MALLOC</code>, <code class="literal">DB_DBT_REALLOC</code>, |
| 139 | or <code class="literal">DB_DBT_USERMEM</code>. |
| 140 | </p> |
| 141 | <p> |
| 142 | For more information on configuring and using |
| 143 | Dbts, see |
| 144 | <a class="xref" href="dbt.html" title="Chapter 4. The Dbt Handle"> |
| 145 | The Dbt Handle |
| 146 | </a>. |
| 147 | </p> |
| 148 | <p> |
| 149 | Note that the response Dbt can be empty. In this |
| 150 | way an application can send an acknowledgement even if |
| 151 | there is no other information that needs to be sent. |
| 152 | </p> |
| 153 | </div> |
| 154 | <div class="sect3" lang="en" xml:lang="en"> |
| 155 | <div class="titlepage"> |
| 156 | <div> |
| 157 | <div> |
| 158 | <h4 class="title"><a id="idp9332504"></a>timeout</h4> |
| 159 | </div> |
| 160 | </div> |
| 161 | </div> |
| 162 | <p> |
| 163 | Configures the amount of time that may elapse while this |
| 164 | method waits for a response from the remote site. If this |
| 165 | timeout period elapses without a response, this method |
| 166 | returns with an error condition. |
| 167 | </p> |
| 168 | <p> |
| 169 | The timeout value must be specified as an unsigned 32-bit |
| 170 | number of microseconds, limiting the maximum timeout to |
| 171 | roughly 71 minutes. |
| 172 | </p> |
| 173 | <p> |
| 174 | A timeout value of <code class="literal">0</code> |
| 175 | indicates that the channel's default timeout value should |
| 176 | be used. This default is configured using the |
| 177 | <a class="xref" href="dbchannel_set_timeout.html" title="DbChannel::set_timeout()">DbChannel::set_timeout()</a> |
| 178 | method. |
| 179 | </p> |
| 180 | </div> |
| 181 | <div class="sect3" lang="en" xml:lang="en"> |
| 182 | <div class="titlepage"> |
| 183 | <div> |
| 184 | <div> |
| 185 | <h4 class="title"><a id="idp9327720"></a>flags</h4> |
| 186 | </div> |
| 187 | </div> |
| 188 | </div> |
| 189 | <p> |
| 190 | This parameter must be set to either |
| 191 | <code class="literal">DB_MULTIPLE</code> or 0. |
| 192 | </p> |
| 193 | <p> |
| 194 | If there is a possibility that the response can consist of |
| 195 | multiple Dbt handles, specify |
| 196 | <code class="literal">DB_MULTIPLE</code> to this parameter. In that |
| 197 | case, the response buffer is formatted for bulk |
| 198 | operations. |
| 199 | </p> |
| 200 | </div> |
| 201 | </div> |
| 202 | <div class="sect2" lang="en" xml:lang="en"> |
| 203 | <div class="titlepage"> |
| 204 | <div> |
| 205 | <div> |
| 206 | <h3 class="title"><a id="idp9348672"></a>Errors</h3> |
| 207 | </div> |
| 208 | </div> |
| 209 | </div> |
| 210 | <p> |
| 211 | The <code class="methodname">DbChannel::send_request()</code> |
| 212 | <span> |
| 213 | |
| 214 | <span> |
| 215 | method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a> |
| 216 | exception, encapsulating one of the following non-zero errors, or return one |
| 217 | of the following non-zero errors: |
| 218 | </span> |
| 219 | </span> |
| 220 | </p> |
| 221 | <div class="sect3" lang="en" xml:lang="en"> |
| 222 | <div class="titlepage"> |
| 223 | <div> |
| 224 | <div> |
| 225 | <h4 class="title"><a id="idp9353168"></a>DB_BUFFER_SMALL</h4> |
| 226 | </div> |
| 227 | </div> |
| 228 | </div> |
| 229 | <p> |
| 230 | <code class="literal">DB_MULTIPLE</code> was not specified for the |
| 231 | response Dbt, but the remote site sent a response |
| 232 | consisting of more than one Dbt; or a buffer |
| 233 | supplied using <code class="literal">DB_DBT_USERMEM</code> |
| 234 | was not large enough to contain the message response. |
| 235 | </p> |
| 236 | </div> |
| 237 | <div class="sect3" lang="en" xml:lang="en"> |
| 238 | <div class="titlepage"> |
| 239 | <div> |
| 240 | <div> |
| 241 | <h4 class="title"><a id="idp9355624"></a>DB_NOSERVER</h4> |
| 242 | </div> |
| 243 | </div> |
| 244 | </div> |
| 245 | <p> |
| 246 | A message was sent to a remote site that has not |
| 247 | configured a message dispatch call-back function. |
| 248 | Use the |
| 249 | <a class="xref" href="repmgr_msg_dispatch.html" title="DbEnv::repmgr_msg_dispatch()">DbEnv::repmgr_msg_dispatch()</a> |
| 250 | method at every site belonging to the replication group to configure a |
| 251 | message dispatch call-back function. |
| 252 | </p> |
| 253 | </div> |
| 254 | <div class="sect3" lang="en" xml:lang="en"> |
| 255 | <div class="titlepage"> |
| 256 | <div> |
| 257 | <div> |
| 258 | <h4 class="title"><a id="idp9334448"></a>EINVAL</h4> |
| 259 | </div> |
| 260 | </div> |
| 261 | </div> |
| 262 | <p> |
| 263 | If this method is called from a Base API application, |
| 264 | or if an invalid flag value or parameter was specified. |
| 265 | </p> |
| 266 | </div> |
| 267 | </div> |
| 268 | <div class="sect2" lang="en" xml:lang="en"> |
| 269 | <div class="titlepage"> |
| 270 | <div> |
| 271 | <div> |
| 272 | <h3 class="title"><a id="idp9352088"></a>Class</h3> |
| 273 | </div> |
| 274 | </div> |
| 275 | </div> |
| 276 | <p> |
| 277 | <a class="link" href="env.html" title="Chapter 5. The DbEnv Handle">DbEnv</a> |
| 278 | </p> |
| 279 | </div> |
| 280 | <div class="sect2" lang="en" xml:lang="en"> |
| 281 | <div class="titlepage"> |
| 282 | <div> |
| 283 | <div> |
| 284 | <h3 class="title"><a id="idp9345448"></a>See Also</h3> |
| 285 | </div> |
| 286 | </div> |
| 287 | </div> |
| 288 | <p> |
| 289 | <a class="xref" href="rep.html#replist" title="Replication and Related Methods">Replication and Related Methods</a> |
| 290 | </p> |
| 291 | </div> |
| 292 | </div> |
| 293 | <div class="navfooter"> |
| 294 | <hr /> |
| 295 | <table width="100%" summary="Navigation footer"> |
| 296 | <tr> |
| 297 | <td width="40%" align="left"><a accesskey="p" href="dbchannel_send_msg.html">Prev</a> </td> |
| 298 | <td width="20%" align="center"> |
| 299 | <a accesskey="u" href="rep.html">Up</a> |
| 300 | </td> |
| 301 | <td width="40%" align="right"> <a accesskey="n" href="dbchannel_set_timeout.html">Next</a></td> |
| 302 | </tr> |
| 303 | <tr> |
| 304 | <td width="40%" align="left" valign="top">DbChannel::send_msg() </td> |
| 305 | <td width="20%" align="center"> |
| 306 | <a accesskey="h" href="index.html">Home</a> |
| 307 | </td> |
| 308 | <td width="40%" align="right" valign="top"> DbChannel::set_timeout()</td> |
| 309 | </tr> |
| 310 | </table> |
| 311 | </div> |
| 312 | </body> |
| 313 | </html> |