|
PreCache NetInjector Documentation Center : PreCache NetInjector Application Development Basic Case, Subscription C |
|
|
|
Basic Case, Subscription code C the complete subscription code The previous code samples presented the basics of subscription. A subscription application retrieves content in much the same way as it was published, albeit after first defining a subscription class. Here is the basic sequence of the subscription process:
#include <stdio.h> #include "PC_utl_log.h" #include "PC_evn_filter.h" #include "PC_evn_proxy.h" #include "PC_evn_notification.h" //Define a callback function. void notify(PC_evn_Notification notification, void* pClosure) { PC_STRING message; PC_UINT size; //Retrieve the value of the predefined attribute. PC_evn_get_predefined_attr_by_name( printf("Incoming notification for (%s):%s\n", }; int main(int argc, char* argv[]) { PC_Status nStatus; //Create a proxy for the channel and client. PC_evn_Proxy p; PC_evn_Subscription_Handle hSubscription; nStatus = PC_evn_create_proxy(&p,7,3001);
if (nStatus != PC_SUCCESS) { printf("Proxy creation has failed\n"); return 0; }
//Submit the subscription. nStatus = PC_evn_subscribe_with_exp( if (nStatus != PC_SUCCESS) { printf("Subscription submission has failed return 0; } printf("Subscription was submitted sleep(30); } In the next chapter, Common Cases, Publication C, we will learn more about attributes. |
|