|
PreCache NetInjector Documentation Center : PreCache NetInjector Application Development Common Cases, Publication C |
|
|
|
Common Cases, publication code C the full code sample for the Common Cases tutorial The sample for this tutorial presented more examples of setting attributes. While the process of the publication is the same as in Basic Case, Publication C, we have added statements for #include <stdio.h> #include "PC_utl_log.h" #include "PC_evn_filter.h" #include "PC_evn_proxy.h" #include "PC_evn_notification.h" main(int argc, char* argv[]) { PC_Status Status; PC_evn_Proxy p; PC_evn_Notification n1,n2; PC_LONG age; PC_CHAR gender; //Create a proxy for the channel and client. nStatus = PC_evn_create_proxy(&p,40,3001);
if (nStatus != PC_SUCCESS) { printf("Proxy creation has failed\n"); return 0; } //Create a notification. nStatus = PC_evn_create_notification( if (nStatus != PC_SUCCESS) { printf("Notification creation has failed return 0; } //Set the values for predefined attributes. PC_evn_set_predefined_attr_by_name( PC_evn_set_predefined_attr_by_name( age = 10; PC_evn_set_predefined_attr_by_name( &age,PC_LONG_TYPE,0); gender = 'F'; PC_evn_set_predefined_attr_by_name( &gender, //Publish the notification. nStatus = PC_evn_publish(p,n1); if (nStatus != PC_SUCCESS) { printf("Failed to publish notification return 0; } //Create a second notification. nStatus = PC_evn_create_notification( if (nStatus != PC_SUCCESS) { printf("Notification creation has failed return 0; } //Set the values for predefined attributes. PC_evn_set_predefined_attr_by_name( "Dolly Parton, I love you!", PC_STRING_TYPE, strlen("Dolly Parton, I love you!")); PC_evn_set_predefined_attr_by_name( "Laurel", PC_STRING_TYPE, strlen("Laurel")); age = 12; PC_evn_set_predefined_attr_by_name( PC_LONG_TYPE,0); gender = 'f'; PC_evn_set_predefined_attr_by_name( PC_CHAR_TYPE,0); //Set a discretionary attribute's value. PC_evn_add_discretionary_attr( PC_STRING_TYPE,strlen("Country Music"));
//Publish the second notification. nStatus = PC_evn_publish(p,n2); if (nStatus != PC_SUCCESS) { printf("Failed to publish notification return 0; } } In the final tutorial chapter, Common Cases, Subscription C, we will build the participating subscriber's application. |
|