source: branches/testFACT++branch/dim/src/examples/test_server1.c@ 18752

Last change on this file since 18752 was 11071, checked in by tbretz, 14 years ago
Replaced v19r21 by a version extracted with 'unzip -a' to get proper unix text format.
File size: 1017 bytes
Line 
1#include <string.h>
2#include <stdlib.h>
3#include <stdio.h>
4#include <dis.h>
5
6int Data1[4000];
7int Data2[4000];
8int Id1, Id2;
9
10void cmnd_rout(int *tag, char *buf, int *size)
11{
12 int cid[2];
13
14 cid[0] = dis_get_conn_id();
15 cid[1] = 0;
16 if(*tag == 1)
17 dis_selective_update_service(Id1, cid);
18 else if(*tag == 2)
19 dis_selective_update_service(Id2, cid);
20}
21
22int main(int argc, char **argv)
23{
24 int i, id, *ptr;
25 char aux[80];
26 char name[84], name1[132];
27 int on = 0;
28 long dnsid = 0;
29 char extra_dns[128];
30 int new_dns = 0;
31/*
32 int buf_sz, buf_sz1;
33*/
34
35dis_set_debug_on();
36
37 i = 0;
38 Data1[0] = i;
39 Id1 = dis_add_service( "Beam1/Data", "C", Data1, 4000, (void *)0, 0 );
40 dis_add_cmnd("Beam1/Cmd","C",cmnd_rout, 1);
41 Data2[0] = i;
42 Id2 = dis_add_service( "Beam2/Data", "C", Data2, 4000, (void *)0, 0 );
43 dis_add_cmnd("Beam2/Cmd","C",cmnd_rout, 2);
44
45 dis_start_serving( argv[1] );
46
47 while(1)
48 {
49 usleep(1000);
50 i++;
51 Data1[0] = i;
52 dis_update_service(Id1);
53 Data2[0] = i;
54 dis_update_service(Id2);
55 }
56 return 1;
57}
58
Note: See TracBrowser for help on using the repository browser.