Next: , Up: Interacting directly with other Peers using the CORE Service   [Contents]

4.5.1 New P2P connections

Before any traffic with a different peer can be exchanged, the peer must be known to the service. This is notified by the CORE connects callback, which communicates the identity of the new peer to the service:

void *
connects (void *cls,
          const struct GNUNET_PeerIdentity *peer,
          struct GNUNET_MQ_Handle *mq)
  return mq;

Note that whatever you return from connects is given as the cls argument to the message handlers for messages from the respective peer.

Exercise: Create a service that connects to the CORE. Then start (and connect) two peers and print a message once your connect callback is invoked.