FACT++  1.0
test_big_client.c
Go to the documentation of this file.
1 #include <dic.h>
2 
3 #define MAX_SERVICES 40000
4 /*
5 int Data[MAX_SERVICES];
6 int Recvd[MAX_SERVICES];
7 */
8 int no_link = -1;
9 
10 void rout(tag, buff, size)
11 int *tag, *size;
12 int *buff;
13 {
14 static int bad = 0;
15 int i;
16 static int n_recvd = 0;
17 
18  if(!bad)
19  {
20  if (*buff == no_link)
21  {
22 /*
23  for(i = 0; i < MAX_SERVICES; i++)
24  Recvd[i] = 0;
25 */
26  bad = 1;
27  n_recvd = 0;
28  }
29  }
30  if(bad)
31  {
32  if (*buff != no_link)
33  {
34 /*
35  for(i = 0; i < MAX_SERVICES; i++)
36  Recvd[i] = 0;
37 */
38  bad = 0;
39  n_recvd = 0;
40  }
41  }
42 /*
43  if(bad)
44  {
45  Recvd[*tag] = *buff;
46  }
47  else
48  {
49  Recvd[*tag] = (*buff)+1;
50  }
51 */
52  n_recvd++;
53 /*
54  for(i = 0; i <= MAX_SERVICES; i++)
55  {
56  if(Recvd[i] != 0)
57  n_recvd++;
58  }
59 */
60 /*
61  if(!((*tag) % 1000))
62 */
63 
64  if(!(n_recvd % 1000))
65  printf("Received n = %d, %d = %d\n",n_recvd, *tag, *buff);
66 }
67 
68 main(argc,argv)
69 int argc;
70 char **argv;
71 {
72  int i;
73  char name[64];
74  int id = 123;
75 
76  dic_set_dns_node("lxplus050.cern.ch");
77 
78 /*
79  dic_set_debug_on();
80 */
81  for(i = 0; i< MAX_SERVICES; i++)
82  {
83  sprintf(name,"%s/Service_%d",argv[2],i);
84  dic_info_service( name, TIMED, 0, 0, 0,
85  rout, i,&no_link, sizeof(no_link) );
86  }
87  while(1)
88  {
89  pause();
90  }
91 }
unsigned dic_info_service(char *serv_name, int req_type, int req_timeout, void *serv_address, int serv_size, void(*usr_routine)(), dim_long tag, void *fill_addr, int fill_size)
Definition: dic.c:601
int no_link
int i
Definition: db_dim_client.c:21
int dic_set_dns_node(char *node)
Definition: open_dns.c:58
main(int argc, char **argv)
#define MAX_SERVICES
void rout(int *tag, int *buff, int *size)
int size
Definition: db_dim_server.c:17
int buff[BUFFSIZE]
Definition: db_dim_client.c:15
#define TIMED
Definition: dim_common.h:8
sprintf(name1,"NewService%d", i)