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