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
|
<?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_connect">
<info>
<link type="guide" xref="mongoc_socket_t" group="function"/>
</info>
<title>mongoc_socket_connect()</title>
<section id="synopsis">
<title>Synopsis</title>
<synopsis><code mime="text/x-csrc"><![CDATA[int
mongoc_socket_connect (mongoc_socket_t *sock,
const struct sockaddr *addr,
socklen_t addrlen,
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>addr</p></td><td><p>A struct sockaddr.</p></td></tr>
<tr><td><p>addrlen</p></td><td><p>A socklen_t.</p></td></tr>
<tr><td><p>expire_at</p></td><td><p>A int64_t containing the absolute timeout using the monotonic clock.</p></td></tr>
</table>
</section>
<section id="description">
<title>Description</title>
<p>This function is a wrapper around the BSD socket <code>connect()</code> interface. It provides better portability between UNIX-like and Microsoft Windows platforms.</p>
<p>This function performs a socket connection but will fail if @expire_at has been reached by the monotonic clock. Keep in mind that this is an absolute timeout in milliseconds. You should add your desired timeout to <code xref="bson:clock">bson_get_monotonic_time()</code>.</p>
</section>
<section id="return">
<title>Returns</title>
<p>0 if successful, -1 on failure and errno is set.</p>
</section>
</page>
|