source: trunk/FACT++/dim/src/examples/db_dim_client.c@ 18341

Last change on this file since 18341 was 11071, checked in by tbretz, 13 years ago
Replaced v19r21 by a version extracted with 'unzip -a' to get proper unix text format.
File size: 1.3 KB
Line 
1// db_dim_client.c : Defines the entry point for the console application.
2//
3// Dietrich Beck
4//
5// This is a very simple DIM service. It listens to a DIM service
6// "SERV_BY_BUFFER" via a callback routine. Each time THIS client
7// receives a service, it sends a new command to the DIM server.
8
9#include <stdio.h>
10#include <dic.h>
11
12#define BUFFSIZE 10000000
13
14int buffer[BUFFSIZE];
15int buff[BUFFSIZE];
16char message[1024];
17int no_link = -1;
18int version;
19int counter;
20int lastValue;
21int i;
22unsigned service_id;
23
24serv_received(tag,address,size)
25int *tag;
26char *address;
27int *size;
28{
29 for (i=0;i<BUFFSIZE;i++) buff[i] = buffer[i]; //copy data to do something useful
30 counter++;
31 sprintf(message, "service received %d\n", counter);
32 printf(message);
33}
34
35void main(int argc, char* argv[])
36{
37
38 //service_id = dic_info_service("testBuffer",MONITORED,0,0,0,serv_received,0,&no_link,4);
39// printf("registering to service\n");
40// counter = 0;
41// service_id = dic_info_service("testBuffer",MONITORED,0,0,0,serv_received,0,&no_link,4);
42 while(1)
43 {
44 printf("registering to service\n");
45 counter = 0;
46 service_id = dic_info_service("testBuffer",MONITORED,0,0,0,serv_received,0,&no_link,4);
47 sleep(1);
48 printf("releasing service\n");
49 dic_release_service(service_id);
50 printf("released service\n");
51 sleep(1);
52 //sprintf(message, "%s", dic_get_error_services());
53 }
54}
55
Note: See TracBrowser for help on using the repository browser.