| 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_msg()</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_close.html" title="DbChannel::close()" /> |
| 12 | <link rel="next" href="dbchannel_send_request.html" title="DbChannel::send_request()" /> |
| 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_msg()</th> |
| 22 | </tr> |
| 23 | <tr> |
| 24 | <td width="20%" align="left"><a accesskey="p" href="dbchannel_close.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_send_request.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_msg"></a>DbChannel::send_msg()</h2> |
| 38 | </div> |
| 39 | </div> |
| 40 | </div> |
| 41 | <pre class="programlisting">#include <db_cxx.h> |
| 42 | |
| 43 | int |
| 44 | DbChannel::send_msg(Dbt *msg, u_int32_t nmsg, u_int32_t flags);</pre> |
| 45 | <p> |
| 46 | The <code class="methodname">DbChannel::send_msg()</code> method sends a |
| 47 | message on the message channel. The message is sent asynchronously; |
| 48 | the method does not wait for a response before returning. This |
| 49 | method usually completes quickly because it only waits for the |
| 50 | local TCP implementation to accept the bytes into its network data |
| 51 | buffer. However, this message could block briefly for longer |
| 52 | messages, and/or if the network data buffer is nearly full. This |
| 53 | method could even block indefinitely if the remote site is slow to |
| 54 | read. |
| 55 | </p> |
| 56 | <p> |
| 57 | If you want to block while waiting for a response from a remote |
| 58 | site, use the |
| 59 | <a class="xref" href="dbchannel_send_request.html" title="DbChannel::send_request()">DbChannel::send_request()</a> |
| 60 | method instead of this method. |
| 61 | </p> |
| 62 | <p> |
| 63 | The message sent by this method is received and handled at |
| 64 | remote sites using a message dispatch callback, which is configured |
| 65 | using the <a class="xref" href="repmgr_msg_dispatch.html" title="DbEnv::repmgr_msg_dispatch()">DbEnv::repmgr_msg_dispatch()</a> |
| 66 | method. Note that the DbChannel::send_msg() method may be used |
| 67 | within the the message dispatch callback on the remote site to send |
| 68 | a response or acknowledgement for messages that it receives and is |
| 69 | handling. |
| 70 | </p> |
| 71 | <p> |
| 72 | This method may be used on channels opened to any destination (see |
| 73 | the <a class="xref" href="repmgr_channel.html" title="DbEnv::repmgr_channel()">DbEnv::repmgr_channel()</a> |
| 74 | method for a list of potential destinations). |
| 75 | </p> |
| 76 | <p> |
| 77 | The <code class="methodname">DbChannel::send_msg()</code> <span> |
| 78 | |
| 79 | <span> |
| 80 | method either returns a non-zero error value or throws an |
| 81 | exception that encapsulates a non-zero error value on |
| 82 | failure, and returns 0 on success. |
| 83 | </span> |
| 84 | </span> |
| 85 | </p> |
| 86 | <div class="sect2" lang="en" xml:lang="en"> |
| 87 | <div class="titlepage"> |
| 88 | <div> |
| 89 | <div> |
| 90 | <h3 class="title"><a id="idp9331144"></a>Parameters</h3> |
| 91 | </div> |
| 92 | </div> |
| 93 | </div> |
| 94 | <div class="sect3" lang="en" xml:lang="en"> |
| 95 | <div class="titlepage"> |
| 96 | <div> |
| 97 | <div> |
| 98 | <h4 class="title"><a id="idp9330496"></a>msg</h4> |
| 99 | </div> |
| 100 | </div> |
| 101 | </div> |
| 102 | <p> |
| 103 | Refers to an array of Dbt handles. For more |
| 104 | information, see |
| 105 | <a class="xref" href="dbt.html" title="Chapter 4. The Dbt Handle"> |
| 106 | The Dbt Handle |
| 107 | </a>. |
| 108 | </p> |
| 109 | <p> |
| 110 | Any flags provided to the Dbt handles used in this |
| 111 | array are ignored. |
| 112 | </p> |
| 113 | </div> |
| 114 | <div class="sect3" lang="en" xml:lang="en"> |
| 115 | <div class="titlepage"> |
| 116 | <div> |
| 117 | <div> |
| 118 | <h4 class="title"><a id="idp9308472"></a>nmsg</h4> |
| 119 | </div> |
| 120 | </div> |
| 121 | </div> |
| 122 | <p> |
| 123 | Indicates how many elements are contained in the |
| 124 | <code class="literal">msg</code> array. |
| 125 | </p> |
| 126 | </div> |
| 127 | <div class="sect3" lang="en" xml:lang="en"> |
| 128 | <div class="titlepage"> |
| 129 | <div> |
| 130 | <div> |
| 131 | <h4 class="title"><a id="idp9327024"></a>flags</h4> |
| 132 | </div> |
| 133 | </div> |
| 134 | </div> |
| 135 | <p> |
| 136 | This parameter is currently unused, and must be |
| 137 | set to 0. |
| 138 | </p> |
| 139 | </div> |
| 140 | </div> |
| 141 | <div class="sect2" lang="en" xml:lang="en"> |
| 142 | <div class="titlepage"> |
| 143 | <div> |
| 144 | <div> |
| 145 | <h3 class="title"><a id="idp9128424"></a>Errors</h3> |
| 146 | </div> |
| 147 | </div> |
| 148 | </div> |
| 149 | <p> |
| 150 | The <code class="methodname">DbChannel::send_msg()</code> |
| 151 | <span> |
| 152 | |
| 153 | <span> |
| 154 | method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a> |
| 155 | exception, encapsulating one of the following non-zero errors, or return one |
| 156 | of the following non-zero errors: |
| 157 | </span> |
| 158 | </span> |
| 159 | </p> |
| 160 | <div class="sect3" lang="en" xml:lang="en"> |
| 161 | <div class="titlepage"> |
| 162 | <div> |
| 163 | <div> |
| 164 | <h4 class="title"><a id="idp9339720"></a>DB_NOSERVER</h4> |
| 165 | </div> |
| 166 | </div> |
| 167 | </div> |
| 168 | <p> |
| 169 | A message was sent to a remote site that has not |
| 170 | configured a message dispatch call-back function. |
| 171 | Use the |
| 172 | <a class="xref" href="repmgr_msg_dispatch.html" title="DbEnv::repmgr_msg_dispatch()">DbEnv::repmgr_msg_dispatch()</a> |
| 173 | method at every site belonging to the replication group to configure a |
| 174 | message dispatch call-back function. |
| 175 | </p> |
| 176 | </div> |
| 177 | <div class="sect3" lang="en" xml:lang="en"> |
| 178 | <div class="titlepage"> |
| 179 | <div> |
| 180 | <div> |
| 181 | <h4 class="title"><a id="idp9337344"></a>EINVAL</h4> |
| 182 | </div> |
| 183 | </div> |
| 184 | </div> |
| 185 | <p> |
| 186 | If this method is called from a Base API application, |
| 187 | or if an invalid flag value or parameter was specified. |
| 188 | </p> |
| 189 | </div> |
| 190 | </div> |
| 191 | <div class="sect2" lang="en" xml:lang="en"> |
| 192 | <div class="titlepage"> |
| 193 | <div> |
| 194 | <div> |
| 195 | <h3 class="title"><a id="idp9308104"></a>Class</h3> |
| 196 | </div> |
| 197 | </div> |
| 198 | </div> |
| 199 | <p> |
| 200 | <a class="link" href="env.html" title="Chapter 5. The DbEnv Handle">DbEnv</a> |
| 201 | </p> |
| 202 | </div> |
| 203 | <div class="sect2" lang="en" xml:lang="en"> |
| 204 | <div class="titlepage"> |
| 205 | <div> |
| 206 | <div> |
| 207 | <h3 class="title"><a id="idp9332224"></a>See Also</h3> |
| 208 | </div> |
| 209 | </div> |
| 210 | </div> |
| 211 | <p> |
| 212 | <a class="xref" href="rep.html#replist" title="Replication and Related Methods">Replication and Related Methods</a> |
| 213 | </p> |
| 214 | </div> |
| 215 | </div> |
| 216 | <div class="navfooter"> |
| 217 | <hr /> |
| 218 | <table width="100%" summary="Navigation footer"> |
| 219 | <tr> |
| 220 | <td width="40%" align="left"><a accesskey="p" href="dbchannel_close.html">Prev</a> </td> |
| 221 | <td width="20%" align="center"> |
| 222 | <a accesskey="u" href="rep.html">Up</a> |
| 223 | </td> |
| 224 | <td width="40%" align="right"> <a accesskey="n" href="dbchannel_send_request.html">Next</a></td> |
| 225 | </tr> |
| 226 | <tr> |
| 227 | <td width="40%" align="left" valign="top">DbChannel::close() </td> |
| 228 | <td width="20%" align="center"> |
| 229 | <a accesskey="h" href="index.html">Home</a> |
| 230 | </td> |
| 231 | <td width="40%" align="right" valign="top"> DbChannel::send_request()</td> |
| 232 | </tr> |
| 233 | </table> |
| 234 | </div> |
| 235 | </body> |
| 236 | </html> |