MIDAS
Loading...
Searching...
No Matches
rpc_clnt.cxx
Go to the documentation of this file.
1/********************************************************************\
2
3 Name: rpc_clnt.c
4 Created by: Stefan Ritt
5
6 Contents: Mini RPC client program for test purposes.
7
8 $Id$
9
10\********************************************************************/
11
12#include "midas.h"
13#include <stdio.h>
14
15/* user RPC ID's must start after RPC_MIN_ID */
16#define RPC_MYTEST RPC_MIN_ID
17
18/* define MYTEST function with some parameters,
19 must match definition on server */
21
22 {RPC_MYTEST, "rpc_mytest",
24 ,
26 ,
28 ,
30 ,
32 ,
34 ,
36 ,
38 ,
40 ,
42 ,
43 {0}
44 }
45 }
46 ,
47
48 {0}
49
50};
51
52/*------------------------------------------------------------------*/
53
54int main()
55{
56 char host_name[80];
58 INT status;
59 BYTE b;
60 WORD w;
61 INT i;
62 float f;
63 double d;
64
65 printf("Remote host name: ");
66 ss_gets(host_name, sizeof(host_name));
67
68 /* register this as an RPC client with rpc_list */
69 rpc_register_client("MYCLIENT", rpc_list);
70
71 /* connect to RPC server */
73 if (status != RPC_SUCCESS) {
74 printf("Cannot connect to RPC server running on %s at port 1750.\n", host_name);
75 return 0;
76 }
77
78 f = 3.5f;
79 d = 4.5;
80
81 /* rpc_mytest just doubles numbers */
82 rpc_client_call(hConn, RPC_MYTEST, 1, 2, 3l, f, d, &b, &w, &i, &f, &d);
83
84 printf("\nResult should be: 2 4 6 7.0 9.0\n");
85 printf("Result is: %d %d %d %1.1f %1.1lf\n", b, w, i, f, d);
86
87 printf("\nhit return...");
88 b = getchar();
89
90 /* disconnect this client from server */
92 return 1;
93}
#define FALSE
Definition cfortran.h:309
#define RPC_SUCCESS
Definition midas.h:698
unsigned short int WORD
Definition mcstd.h:49
unsigned char BYTE
Definition mcstd.h:48
#define TID_DOUBLE
Definition midas.h:343
#define TID_INT32
Definition midas.h:339
#define TID_UINT8
Definition midas.h:328
#define TID_UINT16
Definition midas.h:333
#define TID_FLOAT
Definition midas.h:341
char * ss_gets(char *string, int size)
Definition system.cxx:7770
INT rpc_client_connect(const char *host_name, INT port, const char *client_name, HNDLE *hConnection)
Definition midas.cxx:12012
INT rpc_client_disconnect(HNDLE hConn, BOOL bShutdown)
Definition midas.cxx:12676
INT rpc_client_call(HNDLE hConn, DWORD routine_id,...)
Definition midas.cxx:13472
INT rpc_register_client(const char *name, RPC_LIST *list)
Definition midas.cxx:11808
char host_name[HOST_NAME_LENGTH]
Definition mana.cxx:242
INT i
Definition mdump.cxx:32
INT HNDLE
Definition midas.h:132
#define RPC_OUT
Definition midas.h:1581
#define RPC_IN
Definition midas.h:1580
int INT
Definition midas.h:129
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
RPC_LIST rpc_list[]
Definition rpc_clnt.cxx:20
#define RPC_MYTEST
Definition rpc_clnt.cxx:16
int main()
Definition rpc_clnt.cxx:54
double d
Definition system.cxx:1311