<?xml version="1.0"?>
<page xmlns="http://projectmallard.org/1.0/"
      type="topic"
      style="function"
      xmlns:api="http://projectmallard.org/experimental/api/"
      xmlns:ui="http://projectmallard.org/experimental/ui/"
      id="mongoc_socket_send">
  <info>
    <link type="guide" xref="mongoc_socket_t" group="function"/>
  </info>
  <title>mongoc_socket_send()</title>

  <section id="synopsis">
    <title>Synopsis</title>
    <synopsis><code mime="text/x-csrc"><![CDATA[ssize_t
mongoc_socket_send (mongoc_socket_t *sock,
                    const void      *buf,
                    size_t           buflen,
                    int64_t          expire_at);
]]></code></synopsis>
  </section>

  <section id="parameters">
    <title>Parameters</title>
    <table>
      <tr><td><p>sock</p></td><td><p>A <code xref="mongoc_socket_t">mongoc_socket_t</code>.</p></td></tr>
      <tr><td><p>buf</p></td><td><p>A buffer to send.</p></td></tr>
      <tr><td><p>buflen</p></td><td><p>A size_t with the number of bytes in buf.</p></td></tr>
      <tr><td><p>expire_at</p></td><td><p>A int64_t with an absolute timeout for the operation or 0. The timeout is in monotonic time using microseconds. You can retrieve the current monotonic time with <code xref="bson:clock">bson_get_monotonic_time()</code>.</p></td></tr>
    </table>
  </section>

  <section id="description">
    <title>Description</title>
    <p>Sends buflen bytes in buf to the destination. If a timeout expired, the number of bytes sent will be returned or -1 if no bytes were sent.</p>
  </section>

  <section id="return">
    <title>Returns</title>
    <p>-1 on failure and errno is set, or the number of bytes sent.</p>
  </section>


</page>
