C Client API

powerful. fast. easy.

Your C applications require the utmost in performance and reliability. Use the AMPS C/C++ Client to handcraft applications and libraries in C with blistering performance and rock-solid reliability. The AMPS C/C++ Client allows you to call the same low-level AMPS primitives used by our C++ client. Here's an example to get you started:

Example 1: Connect and Subscribe

Allocate and connect an AMPS client handle with just a few function calls:

 1 #include <amps.h>
 2 #include <stdio.h>
 3      void displayError(amps_handle client)
 4      {
 5        char textBuffer[512];
 6        amps_client_get_error(client, textBuffer, sizeof(textBuffer));
 7        printf("error from AMPS: %s\n", textBuffer);
 8      }
10      amps_result receiveMessage(amps_handle message, void* userdata)
11      {
12        amps_char* data;
13        size_t len;
14        amps_message_get_data(message, &data, &len);
15        fwrite(data, 1, len, stdout);
16        fwrite("\n", 1, 1, stdout);
17        return AMPS_E_OK;
18      }
20      int main()
21      {
22        amps_handle client, m;
23        const char* uri="tcp://localhost:9004/nvfix";
25        client = amps_client_create("myApp");
26        if(amps_client_connect(client, uri) != AMPS_E_OK) {
27          displayError(client);
28          return -1;
29        }
30        m = amps_message_create(client);
31        amps_message_set_field_value_nts(m, AMPS_QueryID, "1");
32        amps_message_set_field_value_nts(m, AMPS_CommandId, "1");
33        amps_message_set_field_value_nts(m, AMPS_Command,
34          "subscribe");
35        amps_message_set_field_value_nts(m, AMPS_Topic, "orders");
36        amps_message_set_field_value_nts(m, AMPS_Filter,
37          "/symbol LIKE 'ABCD'");
38        amps_client_set_message_handler(client, receiveMessage, NULL);
40        amps_client_send(client, m);
42        sleep(10);
43        return 0;
44      }

In this example, we connect to AMPS and build an AMPS message to subscribe to the "orders" topic. Messages are filtered on the server: we're only sent messages whose "symbol" field contains "ABCD". We set our "receiveMessage" function to receive messages from the server as they arrive and write their data to stdout. If any errors occur while connecting, they're written to stdout as well.

Everything You Need

Ready to learn more? The AMPS C/C++ Client includes everything you need to get started: libraries, sample applications, developer's guide, and reference documentation. Each AMPS Client includes complete source code so you can fully learn and understand AMPS, and best integrate it into your environment.

Click here (Linux) or here (Windows) to download and start using the AMPS C/C++ Client. Once you've downloaded it, read the Developer Guide to get started.

If you need more help getting started, the 60East Technologies support and services team is ready to provide the support you need to help you CRANK UP THE AMPS.

The current release of the C client is version, which supports AMPS servers version 5.3 and earlier.