FACT++
1.0
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
db_dim_client.c
Go to the documentation of this file.
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
14
int
buffer
[
BUFFSIZE
];
15
int
buff
[
BUFFSIZE
];
16
char
message
[1024];
17
int
no_link
= -1;
18
int
version
;
19
int
counter
;
20
int
lastValue
;
21
int
i
;
22
unsigned
service_id
;
23
24
serv_received
(tag,address,
size
)
25
int *tag;
26
char
*address;
27
int
*
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
35
void
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
dic_info_service
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
service_id
unsigned service_id
Definition:
db_dim_client.c:22
i
int i
Definition:
db_dim_client.c:21
MONITORED
#define MONITORED
Definition:
dim_common.h:9
dic.h
BUFFSIZE
#define BUFFSIZE
Definition:
db_dim_client.c:12
buffer
int buffer[BUFFSIZE]
Definition:
db_dim_client.c:14
size
int size
Definition:
db_dim_server.c:17
main
void main(int argc, char *argv[])
Definition:
db_dim_client.c:35
counter
int counter
Definition:
db_dim_client.c:19
version
int version
Definition:
db_dim_client.c:18
buff
int buff[BUFFSIZE]
Definition:
db_dim_client.c:15
dic_release_service
void dic_release_service(unsigned service_id)
Definition:
dic.c:1025
serv_received
serv_received(int *tag, char *address, int *size)
Definition:
db_dim_client.c:24
sprintf
sprintf(name1,"NewService%d", i)
lastValue
int lastValue
Definition:
db_dim_client.c:20
message
char message[1024]
Definition:
db_dim_client.c:16
no_link
int no_link
Definition:
db_dim_client.c:17
dim
src
examples
db_dim_client.c
Generated on Sun Sep 18 2016 20:50:18 for FACT++ by
1.8.11