Line data Source code
1 : /********************************************************************\
2 :
3 : Name: rpc_test.c
4 : Created by: Stefan Ritt
5 :
6 : Contents: Mini RPC client for testing purposes
7 :
8 : This program connects to a server running the MIDAS
9 : main server. It calls the routine rpc_test on this
10 : server, which simply doubles some arguments. By
11 : receiving the proper results, one can check that the
12 : parameter passing via MIDAS RPCs works correctly.
13 :
14 : $Id$
15 :
16 : \********************************************************************/
17 :
18 : #include "midas.h"
19 : #include "mrpc.h"
20 : #include <stdio.h>
21 :
22 : /*------------------------------------------------------------------*/
23 :
24 : #ifdef OS_VXWORKS
25 : rpc_test(char *ahost_name)
26 : #else
27 0 : int main()
28 : #endif
29 : {
30 : char host_name[256];
31 : INT status;
32 : BYTE b;
33 : WORD w;
34 : INT i;
35 : float f;
36 : double d;
37 :
38 : #ifdef OS_VXWORKS
39 : strcpy(host_name, ahost_name);
40 : #else
41 0 : printf("Remote host IP address: ");
42 0 : ss_gets(host_name, 256);
43 : #endif
44 :
45 0 : status = cm_connect_experiment(host_name, "", "RPC_TEST", NULL);
46 0 : if (status != CM_SUCCESS)
47 0 : return 1;
48 :
49 0 : f = 3.5f;
50 0 : d = 4.5;
51 :
52 : /* rpc_test just doubles numbers */
53 0 : rpc_call(RPC_TEST, 1, 2, 3l, f, d, &b, &w, &i, &f, &d);
54 :
55 0 : printf("\nResult should be: 2 4 6 7.0 9.0\n");
56 0 : printf("Result is: %d %d %ld %1.1f %1.1lf\n", b, w, (long int) i, f, d);
57 :
58 0 : printf("\nhit return...");
59 0 : b = getchar();
60 :
61 0 : cm_disconnect_experiment();
62 0 : return 1;
63 : }
|