Next: , Up: Writing a Client Library   [Contents] Connecting to the Service

Before a client library can implement the application-specific protocol with the service, a connection must be created:

struct GNUNET_MQ_MessageHandlers handlers[] = {
    // ...
  GNUNET_MQ_handler_end ()
struct GNUNET_MQ_Handle *mq;

mq = GNUNET_CLIENT_connect (cfg,

As a result a GNUNET\_MQ\_Handle is returned which can to used henceforth to transmit messages to the service. The complete MQ API can be found in gnunet\_mq\_lib.h. The hanlders array in the example above is incomplete. Here is where you will define which messages you expect to receive from the service, and which functions handle them. The error\_cb is a function that is to be called whenever there are errors communicating with the service.