MIDAS
Loading...
Searching...
No Matches
rpc_test.cxx
Go to the documentation of this file.
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
26#else
27int 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 printf("Remote host IP address: ");
42 ss_gets(host_name, 256);
43#endif
44
45 status = cm_connect_experiment(host_name, "", "RPC_TEST", NULL);
46 if (status != CM_SUCCESS)
47 return 1;
48
49 f = 3.5f;
50 d = 4.5;
51
52 /* rpc_test just doubles numbers */
53 rpc_call(RPC_TEST, 1, 2, 3l, f, d, &b, &w, &i, &f, &d);
54
55 printf("\nResult should be: 2 4 6 7.0 9.0\n");
56 printf("Result is: %d %d %ld %1.1f %1.1lf\n", b, w, (long int) i, f, d);
57
58 printf("\nhit return...");
59 b = getchar();
60
62 return 1;
63}
INT cm_connect_experiment(const char *host_name, const char *exp_name, const char *client_name, void(*func)(char *))
Definition midas.cxx:2278
INT cm_disconnect_experiment(void)
Definition midas.cxx:2846
#define CM_SUCCESS
Definition midas.h:582
unsigned short int WORD
Definition mcstd.h:49
unsigned char BYTE
Definition mcstd.h:48
char * ss_gets(char *string, int size)
Definition system.cxx:7770
INT rpc_call(DWORD routine_id,...)
Definition midas.cxx:13663
#define RPC_TEST
Definition mrpc.h:122
char host_name[HOST_NAME_LENGTH]
Definition mana.cxx:242
INT i
Definition mdump.cxx:32
int INT
Definition midas.h:129
INT rpc_test(BYTE b, WORD w, INT i, float f, double d, BYTE *b1, WORD *w1, INT *i1, float *f1, double *d1)
Definition mserver.cxx:399
DWORD status
Definition odbhist.cxx:39
TH1X EXPRT * h1_book(const char *name, const char *title, int bins, double min, double max)
Definition rmidas.h:24
int main()
Definition rpc_test.cxx:27
double d
Definition system.cxx:1311