<trclass="memdesc:ga740be1ba16a8570eb98ef6755ebf52ce"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Connects to a <code>NATS Server</code> using the provided options. <br/></td></tr>
<trclass="memdesc:gaa89c06e30e19ff361125bfc9114d89a8"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Process a read event when using external event loop. <br/></td></tr>
<trclass="memdesc:gad81b603b84c0180aefc6d5ebad7f2a47"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Process a write event when using external event loop. <br/></td></tr>
<trclass="memdesc:gafb83c8d7970ba68be0e6c40c38cdfde4"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Connects to a <code>NATS Server</code> using any of the URL from the given list. <br/></td></tr>
<trclass="memdesc:ga530f0f1c75c58a81aae1a59f15b46d9f"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Test if connection has been closed. <br/></td></tr>
<trclass="memdesc:ga5aa349fc3895dde772671b324b07a688"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Test if connection is reconnecting. <br/></td></tr>
<trclass="memdesc:ga15a0f8aa9a6f621535d01593a4c8edd5"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Test if connection is draining. <br/></td></tr>
<trclass="memdesc:ga33fa209522e5e0226b5b7c7d720a3b98"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns the current state of the connection. <br/></td></tr>
<trclass="memdesc:ga0433159e518540ff874c4026fe9cd0c5"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns the number of bytes to be sent to the server. <br/></td></tr>
<trclass="memdesc:ga85915ef0c8b87993be1b076099d6a7c1"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Flushes the connection with a given timeout. <br/></td></tr>
<trclass="memdesc:ga68e7149f7ff1cc4989b3f795fa7e76d9"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns the maximum message payload. <br/></td></tr>
<trclass="memdesc:ga68821a8ae1176096b5afef7fdc7947ec"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Gets the connection statistics. <br/></td></tr>
<trclass="memdesc:gaf623280407c43ade02285005f0642e6d"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Gets the URL of the currently connected server. <br/></td></tr>
<trclass="memdesc:gaf4ee7262e35e44c40ad5dfe9240db76b"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns the list of server URLs known to this connection. <br/></td></tr>
<trclass="memdesc:gad25c77be0873495412c90a73fe450708"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns the list of discovered server URLs. <br/></td></tr>
<trclass="memdesc:gab6cfa9cb6857ae10f096a94f5e244e63"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Gets the last connection error. <br/></td></tr>
<trclass="memdesc:ga747513ba6ab63fdf9a72bfc8025a14ba"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Gets the current client ID assigned by the server. <br/></td></tr>
<trclass="memdesc:ga59bdc4ad9fea2053f5d3841f6b83f88b"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Drains the connection with default timeout. <br/></td></tr>
<trclass="memdesc:gae06fe6f5933f216d6d93645a122a7dd4"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Drains the connection with given timeout. <br/></td></tr>
<trclass="memdesc:ga6960cfdbaac3b8759784f352d4c264f8"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Signs any 'message' using the connection's user credentials. <br/></td></tr>
<trclass="memdesc:gadafcfeeeac2733c7119981ab97b7103d"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns the client's IP address as reported by the server. <br/></td></tr>
<trclass="memdesc:gaa3fd27e6e7d8131e679d4f10e201c435"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns the round trip time between this client and the server. <br/></td></tr>
<trclass="memdesc:gad765b80ae8e1a06a7a942cccf29f042a"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns if the connection to current server supports headers. <br/></td></tr>
<trclass="memdesc:ga761095a42374b4dafa178df7d7652dd5"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns the connection local IP and port. <br/></td></tr>
<trclass="memdesc:gafda2f702276fb0ac301efac10df09495"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Destroys the connection object. <br/></td></tr>
<p>Attempts to connect to a <code>NATS Server</code> with multiple options.</p>
<p>This call is cloning the <aclass="el"href="group__types_group.html#gabcc48b40a81fe302188f4ee06ea9c54e"title="Way to configure a natsConnection.">natsOptions</a> object. Once this call returns, changes made to the <code>options</code> will not have an effect to this connection. The <code>options</code> can however be changed prior to be passed to another <aclass="el"href="group__conn_mgt_group.html#ga740be1ba16a8570eb98ef6755ebf52ce"title="Connects to a NATS Server using the provided options.">natsConnection_Connect()</a> call if desired.</p>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="group__types_group.html#gabcc48b40a81fe302188f4ee06ea9c54e"title="Way to configure a natsConnection.">natsOptions</a></dd>
<dd>
<aclass="el"href="group__conn_mgt_group.html#gafda2f702276fb0ac301efac10df09495"title="Destroys the connection object.">natsConnection_Destroy()</a></dd></dl>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">nc</td><td>the location where to store the pointer to the newly created <aclass="el"href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec"title="A connection to a NATS Server.">natsConnection</a> object. </td></tr>
<tr><tdclass="paramname">options</td><td>the options to use for this connection. If <code>NULL</code> this call is equivalent to <aclass="el"href="group__conn_mgt_group.html#gafb83c8d7970ba68be0e6c40c38cdfde4"title="Connects to a NATS Server using any of the URL from the given list.">natsConnection_ConnectTo()</a> with <aclass="el"href="nats_8h.html#a911c54900b46b968205871cd9f68d36c"title="The default NATS Server URL.">NATS_DEFAULT_URL</a>. </td></tr>
<p>When using an external event loop, and the callback indicating that the socket is ready for reading, this call will read data from the socket and process it.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">nc</td><td>the pointer to the <aclass="el"href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec"title="A connection to a NATS Server.">natsConnection</a> object.</td></tr>
</table>
</dd>
</dl>
<dlclass="section warning"><dt>Warning</dt><dd>This API is reserved for external event loop adapters. </dd></dl>
<p>When using an external event loop, and the callback indicating that the socket is ready for writing, this call will write data to the socket.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">nc</td><td>the pointer to the <aclass="el"href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec"title="A connection to a NATS Server.">natsConnection</a> object.</td></tr>
</table>
</dd>
</dl>
<dlclass="section warning"><dt>Warning</dt><dd>This API is reserved for external event loop adapters. </dd></dl>
<p>Attempts to connect to a <code>NATS Server</code>.</p>
<p>This call supports multiple comma separated URLs. If more than one is specified, it behaves as if you were using a <aclass="el"href="group__types_group.html#gabcc48b40a81fe302188f4ee06ea9c54e"title="Way to configure a natsConnection.">natsOptions</a> object and called <aclass="el"href="group__opts_group.html#gacb7e964ae54b74d972d72e118b7b8bdf"title="Set the list of servers to try to (re)connect to.">natsOptions_SetServers()</a> with the equivalent array of URLs. The list is randomized before the connect sequence starts.</p>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="group__conn_mgt_group.html#gafda2f702276fb0ac301efac10df09495"title="Destroys the connection object.">natsConnection_Destroy()</a></dd>
<dd>
<aclass="el"href="group__opts_group.html#gacb7e964ae54b74d972d72e118b7b8bdf"title="Set the list of servers to try to (re)connect to.">natsOptions_SetServers()</a></dd></dl>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">nc</td><td>the location where to store the pointer to the newly created <aclass="el"href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec"title="A connection to a NATS Server.">natsConnection</a> object. </td></tr>
<tr><tdclass="paramname">urls</td><td>the URL to connect to, or the list of URLs to chose from. If <code>NULL</code> this call is equivalent to <aclass="el"href="group__conn_mgt_group.html#gafb83c8d7970ba68be0e6c40c38cdfde4"title="Connects to a NATS Server using any of the URL from the given list.">natsConnection_ConnectTo()</a> with <aclass="el"href="nats_8h.html#a911c54900b46b968205871cd9f68d36c"title="The default NATS Server URL.">NATS_DEFAULT_URL</a></td></tr>
<tr><tdclass="paramname">nc</td><td>the pointer to the <aclass="el"href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec"title="A connection to a NATS Server.">natsConnection</a> object. </td></tr>
<tr><tdclass="paramname">nc</td><td>the pointer to the <aclass="el"href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec"title="A connection to a NATS Server.">natsConnection</a> object. </td></tr>
<tr><tdclass="paramname">nc</td><td>the pointer to the <aclass="el"href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec"title="A connection to a NATS Server.">natsConnection</a> object. </td></tr>
<tr><tdclass="paramname">nc</td><td>the pointer to the <aclass="el"href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec"title="A connection to a NATS Server.">natsConnection</a> object. </td></tr>
<p>When calling any of the publish functions, data is not necessarily immediately sent to the server. Some buffering occurs, allowing for better performance. This function indicates if there is any data not yet transmitted to the server.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">nc</td><td>the pointer to the <aclass="el"href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec"title="A connection to a NATS Server.">natsConnection</a> object. </td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>the number of bytes to be sent to the server, or -1 if the connection is closed. </dd></dl>
<p>Performs a round trip to the server and return when it receives the internal reply.</p>
<p>Note that if this call occurs when the connection to the server is lost, the <code>PING</code> will not be echoed even if the library can connect to a new (or the same) server. Therefore, in such situation, this call will fail with the status <aclass="el"href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80abef517217119e8446a8e3382e1f37eb3">NATS_CONNECTION_DISCONNECTED</a>.</p>
<p>If the connection is closed while this call is in progress, then the status <aclass="el"href="status_8h.html#a6d667c1f8dd289a7e0f39bf10e800b51aa78753a4de2d0379078bb09cdc1acdb2"title="The connection is closed.">NATS_CONN_STATUS_CLOSED</a> would be returned instead.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">nc</td><td>the pointer to the <aclass="el"href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec"title="A connection to a NATS Server.">natsConnection</a> object. </td></tr>
<p>Performs a round trip to the server and return when it receives the internal reply, or if the call times-out (timeout is expressed in milliseconds).</p>
<p>See possible failure case described in <aclass="el"href="group__conn_mgt_group.html#ga1c98f8d89bb8e20ea8621e860a90267f"title="Flushes the connection.">natsConnection_Flush()</a>.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">nc</td><td>the pointer to the <aclass="el"href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec"title="A connection to a NATS Server.">natsConnection</a> object. </td></tr>
<tr><tdclass="paramname">timeout</td><td>in milliseconds, is the time allowed for the flush to complete before <aclass="el"href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80ab88994c9ea9889ac4d9d656d62f550ed">NATS_TIMEOUT</a> error is returned. </td></tr>
<p>Returns the maximum message payload accepted by the server. The information is gathered from the <code>NATS Server</code> when the connection is first established.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">nc</td><td>the pointer to the <aclass="el"href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec"title="A connection to a NATS Server.">natsConnection</a> object. </td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>the maximum message payload. </dd></dl>
<p>Copies in the provided statistics structure, a snapshot of the statistics for this connection.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">nc</td><td>the pointer to the <aclass="el"href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec"title="A connection to a NATS Server.">natsConnection</a> object. </td></tr>
<tr><tdclass="paramname">stats</td><td>the pointer to a <aclass="el"href="group__types_group.html#ga57a4b8c7109e2773878655722ce028aa"title="Statistics of a natsConnection.">natsStatistics</a> object in which statistics will be copied. </td></tr>
<p>Copies in the given buffer, the connected server's Url. If the buffer is too small, an error is returned.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">nc</td><td>the pointer to the <aclass="el"href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec"title="A connection to a NATS Server.">natsConnection</a> object. </td></tr>
<tr><tdclass="paramname">buffer</td><td>the buffer in which the URL is copied. </td></tr>
<tr><tdclass="paramname">bufferSize</td><td>the size of the buffer. </td></tr>
<p>Copies in the given buffer, the connected server's Id. If the buffer is too small, an error is returned.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">nc</td><td>the pointer to the <aclass="el"href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec"title="A connection to a NATS Server.">natsConnection</a> object. </td></tr>
<tr><tdclass="paramname">buffer</td><td>the buffer in which the server id is copied. </td></tr>
<tr><tdclass="paramname">bufferSize</td><td>the size of the buffer. </td></tr>
<p>Returns the list of known servers, including additional servers discovered after a connection has been established (with servers version 0.9.2 and above).</p>
<p>No credential information is included in any of the server URLs returned by this call.<br/>
If you want to use any of these URLs to connect to a server that requires authentication, you will need to use <aclass="el"href="group__opts_group.html#ga5b99da7dd74aac3be962f323c3863d9e"title="Sets the user name/password to use when not specified in the URL.">natsOptions_SetUserInfo</a> or <aclass="el"href="group__opts_group.html#gad58a5b9dabadeebda30e952ff7b39193"title="Sets the token to use when not specified in the URL.">natsOptions_SetToken</a>.</p>
<dlclass="section note"><dt>Note</dt><dd>The user is responsible for freeing the memory of the returned array.</dd></dl>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">nc</td><td>the pointer to the <aclass="el"href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec"title="A connection to a NATS Server.">natsConnection</a> object. </td></tr>
<tr><tdclass="paramname">servers</td><td>the location where to store the pointer to the array of server URLs. </td></tr>
<tr><tdclass="paramname">count</td><td>the location where to store the number of elements of the returned array. </td></tr>
<p>Unlike <aclass="el"href="group__conn_mgt_group.html#gaf4ee7262e35e44c40ad5dfe9240db76b"title="Returns the list of server URLs known to this connection.">natsConnection_GetServers</a>, this function only returns the list of servers that have been discovered after the a connection has been established (with servers version 0.9.2 and above).</p>
<p>No credential information is included in any of the server URLs returned by this call.<br/>
If you want to use any of these URLs to connect to a server that requires authentication, you will need to use <aclass="el"href="group__opts_group.html#ga5b99da7dd74aac3be962f323c3863d9e"title="Sets the user name/password to use when not specified in the URL.">natsOptions_SetUserInfo</a> or <aclass="el"href="group__opts_group.html#gad58a5b9dabadeebda30e952ff7b39193"title="Sets the token to use when not specified in the URL.">natsOptions_SetToken</a>.</p>
<dlclass="section note"><dt>Note</dt><dd>The user is responsible for freeing the memory of the returned array.</dd></dl>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">nc</td><td>the pointer to the <aclass="el"href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec"title="A connection to a NATS Server.">natsConnection</a> object. </td></tr>
<tr><tdclass="paramname">servers</td><td>the location where to store the pointer to the array of server URLs. </td></tr>
<tr><tdclass="paramname">count</td><td>the location where to store the number of elements of the returned array. </td></tr>
<p>Returns the last known error as a 'natsStatus' and the location to the null-terminated error string.</p>
<dlclass="section warning"><dt>Warning</dt><dd>The returned string is owned by the connection object and must not be freed.</dd></dl>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">nc</td><td>the pointer to the <aclass="el"href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec"title="A connection to a NATS Server.">natsConnection</a> object. </td></tr>
<tr><tdclass="paramname">lastError</td><td>the location where the pointer to the connection's last error string is copied. </td></tr>
<p>Returns the client ID assigned by the server to which the client is currently connected to.</p>
<dlclass="section note"><dt>Note</dt><dd>The value may change if the client reconnects.</dd></dl>
<p>This function returns <aclass="el"href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80a8a4e298931ba0698a72e397b1b57c885"title="The server does not support this action.">NATS_NO_SERVER_SUPPORT</a> if the server's version is less than 1.2.0.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">nc</td><td>the pointer to the <aclass="el"href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec"title="A connection to a NATS Server.">natsConnection</a> object. </td></tr>
<tr><tdclass="paramname">cid</td><td>the location where to store the client ID. </td></tr>
<p>Drain will put a connection into a drain state. All subscriptions will immediately be put into a drain state. Upon completion, the publishers will be drained and can not publish any additional messages. Upon draining of the publishers, the connection will be closed. Use the <aclass="el"href="group__opts_group.html#ga44410242e73134e5bb51ef27904a9253"title="Sets the callback to be invoked when a connection to a server is permanently lost.">natsOptions_SetClosedCB()</a> option to know when the connection has moved from draining to closed.</p>
<p>This call uses a default drain timeout of 30 seconds.</p>
<dlclass="section warning"><dt>Warning</dt><dd>This function does not block waiting for the draining operation to complete.</dd></dl>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="group__opts_group.html#ga44410242e73134e5bb51ef27904a9253"title="Sets the callback to be invoked when a connection to a server is permanently lost.">natsOptions_SetClosedCB</a></dd>
<dd>
<aclass="el"href="group__conn_mgt_group.html#gae06fe6f5933f216d6d93645a122a7dd4"title="Drains the connection with given timeout.">natsConnection_DrainTimeout</a></dd></dl>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">nc</td><td>the pointer to the <aclass="el"href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec"title="A connection to a NATS Server.">natsConnection</a> object. </td></tr>
<p>Identical to <aclass="el"href="group__conn_mgt_group.html#ga59bdc4ad9fea2053f5d3841f6b83f88b"title="Drains the connection with default timeout.">natsConnection_Drain</a> but the timeout can be specified here.</p>
<p>The value is expressed in milliseconds. Zero or negative value means that the operation will not timeout.</p>
<dlclass="section warning"><dt>Warning</dt><dd>This function does not block waiting for the draining operation to complete.</dd></dl>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="group__opts_group.html#ga44410242e73134e5bb51ef27904a9253"title="Sets the callback to be invoked when a connection to a server is permanently lost.">natsOptions_SetClosedCB</a></dd>
<dd>
<aclass="el"href="group__conn_mgt_group.html#ga59bdc4ad9fea2053f5d3841f6b83f88b"title="Drains the connection with default timeout.">natsConnection_Drain</a></dd></dl>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">nc</td><td>the pointer to the <aclass="el"href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec"title="A connection to a NATS Server.">natsConnection</a> object. </td></tr>
<tr><tdclass="paramname">timeout</td><td>the allowed time for a drain operation to complete, expressed in milliseconds. </td></tr>
<p>The connection must have been created with the <aclass="el"href="group__opts_group.html#ga59b47f7b7a19085cf8eaada9bfe5606e"title="Sets the file(s) to use to fetch user JWT and seed required to sign nonce.">natsOptions_SetUserCredentialsFromFiles</a>.</p>
<p>This call will sign the given message with the private key extracted through the user credentials file(s).</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">nc</td><td>the pointer to the <aclass="el"href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec"title="A connection to a NATS Server.">natsConnection</a> object. </td></tr>
<tr><tdclass="paramname">message</td><td>the byte array to sign. </td></tr>
<tr><tdclass="paramname">messageLen</td><td>the length of the given byte array. </td></tr>
<tr><tdclass="paramname">sig</td><td>an array of 64 bytes in which the signature will be copied. </td></tr>
<p>When a connection is created to the server, the server identifies the connection's remote IP address and return it back to the client.</p>
<dlclass="section note"><dt>Note</dt><dd>The user is responsible to free memory allocated to store the client IP address.</dd>
<dd>
This is supported on servers >= version 2.1.6. Calling <aclass="el"href="group__conn_mgt_group.html#gadafcfeeeac2733c7119981ab97b7103d"title="Returns the client's IP address as reported by the server.">natsConnection_GetClientIP()</a> with server below this version will return the <aclass="el"href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80a8a4e298931ba0698a72e397b1b57c885"title="The server does not support this action.">NATS_NO_SERVER_SUPPORT</a> error.</dd></dl>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="group__conn_mgt_group.html#ga761095a42374b4dafa178df7d7652dd5"title="Returns the connection local IP and port.">natsConnection_GetLocalIPAndPort</a> to get the local IP and port instead.</dd></dl>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">nc</td><td>the pointer to the <aclass="el"href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec"title="A connection to a NATS Server.">natsConnection</a> object. </td></tr>
<tr><tdclass="paramname">ip</td><td>the memory location where to store the client's IP string. The user is responsible from freeing this memory. </td></tr>
<dlclass="section note"><dt>Note</dt><dd>If the library is currently trying to reconnect, this call will return <aclass="el"href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80abef517217119e8446a8e3382e1f37eb3">NATS_CONNECTION_DISCONNECTED</a>.</dd></dl>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">nc</td><td>the pointer to the <aclass="el"href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec"title="A connection to a NATS Server.">natsConnection</a> object. </td></tr>
<tr><tdclass="paramname">rtt</td><td>the memory location where to store the rtt. </td></tr>
<p>Returns NATS_OK if the server this client is currently connected to supports headers, NATS_NO_SERVER_SUPPORT otherwise.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">nc</td><td>the pointer to the <aclass="el"href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec"title="A connection to a NATS Server.">natsConnection</a> object. </td></tr>
<p>Unlike <aclass="el"href="group__conn_mgt_group.html#gadafcfeeeac2733c7119981ab97b7103d"title="Returns the client's IP address as reported by the server.">natsConnection_GetClientIP</a>, this function returns the connection's local IP and port.</p>
<dlclass="section note"><dt>Note</dt><dd>The user is responsible for freeing the memory allocated for the returned IP string.</dd></dl>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">nc</td><td>the pointer of the <aclass="el"href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec"title="A connection to a NATS Server.">natsConnection</a> object. </td></tr>
<tr><tdclass="paramname">ip</td><td>the memory location where to store the local IP string. The user is responsible from freeing this memory. </td></tr>
<tr><tdclass="paramname">port</td><td>the memory location where to store the local port.</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd><aclass="el"href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80a9cee6c417868ecaa69f99ff4f6576990"title="Success.">NATS_OK</a> on success. </dd>
<dd>
<aclass="el"href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80abef517217119e8446a8e3382e1f37eb3">NATS_CONNECTION_DISCONNECTED</a> if disconnected. </dd>
<dd>
<aclass="el"href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80a476d7bcf9a593b749e435f20a9156eff">NATS_CONNECTION_CLOSED</a> is connection is closed. </dd>
<dd>
<aclass="el"href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80a984189ec4cfe3e7647268c99f7e49ec9"title="Some system function returned an error.">NATS_SYS_ERROR</a> if a system error getting the IP and port occurred. </dd>
<dd>
<aclass="el"href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80a62ff6f5cc64399631defc0119731b514">NATS_NO_MEMORY</a> if the library was unable to allocate memory for the returned IP string. </dd></dl>
<p>Closes the connection to the server. This call will release all blocking calls, such as <aclass="el"href="group__conn_mgt_group.html#ga1c98f8d89bb8e20ea8621e860a90267f"title="Flushes the connection.">natsConnection_Flush()</a> and <aclass="el"href="group__sub_group.html#ga6538a5d78dfb0f16514b94c8e74c11af"title="Returns the next available message.">natsSubscription_NextMsg()</a>. The connection object is still usable until the call to <aclass="el"href="group__conn_mgt_group.html#gafda2f702276fb0ac301efac10df09495"title="Destroys the connection object.">natsConnection_Destroy()</a>.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">nc</td><td>the pointer to the <aclass="el"href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec"title="A connection to a NATS Server.">natsConnection</a> object. </td></tr>
<p>Destroys the connection object, freeing up memory. If not already done, this call first closes the connection to the server.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">nc</td><td>the pointer to the <aclass="el"href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec"title="A connection to a NATS Server.">natsConnection</a> object. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- HTML footer for doxygen 1.8.10-->
<!-- start footer part -->
<divid="nav-path"class="navpath"><!-- id is needed for treeview function! -->
<ul>
<liclass="footer">NATS.IO Supported By Synadia Communications Inc.