Re: Running IDL RPC on Linux [message #43180] |
Fri, 18 March 2005 02:56 |
Nigel Wade
Messages: 286 Registered: March 1998
|
Senior Member |
|
|
webuser@globe.gov wrote:
> Hi,
>
> We run IDL through the RPC interface written in C and are currently
> porting our application (website) from IRIX to Linux, and upgrading to
> IDL 6.0. We have IDL as an RPC server and our own programs as clients.
> Each idlrpc server handles simultaneous requests from multiple
> clients. A development instance typically runs 4 idlrpc
> servers/sessions, and a production instance runs 14 idlrpc sessions.
> Here are some system details:
>
> NEW SYSTEM:
> Version: IDL 6.0
> OS: Linux, Debian 3.0
>
> OLD SYSTEM:
> Version: IDL 5.3
> OS: IRIX64, release 6.5
>
> Our commands for starting idlrpc sessions are:
> on Linux:
> /usr/local/rsi/idl_6.0/bin/idlrpc -server=C2500001
> /usr/local/rsi/idl_6.0/bin/idlrpc -server=C2500002
> etc.
> on IRIX:
> /usr/local/rsi/idl_5.3/bin/idlrpc -server=C2500001
> etc.
>
> On our new system, idlrpc seems to start up correctly with such
> commands. The current status of porting is that web applications which
> are supposed to run IDL through idlrpc are not able to connect to an
> idlrpc server. (Error messages include "Problems acquiring server",
> "Can't find server", "no host".)
>
> We have conducted these tests:
>
> Start idlrpc without any options, so its main process looks as follows:
> www1 3132 3121 0 17:52 pts/0 00:00:00
> /usr/local/rsi/idl_6.0/bin/bin.linux.x86/idlrpc
>
> Test1 program source code:
> ----------
> #include <stdio.h>
> #include "idl_rpc.h"
>
> int main(int argc, char **argv)
> {
> CLIENT *pClient;
> int i;
> IDL_VPTR v;
> double *d;
>
> /* Initialize the Client */
> if((pClient = IDL_RPCInit(0, (char*)NULL)) == (CLIENT*)NULL)
> {
> fprintf(stderr, "Can't register with IDL server.\n");
> exit(1);
> }
> /* initialize the data structure */
> IDL_RPCExecuteStr(pClient, "data=dindgen(10)");
>
> /* Get the data variable back from IDL */
> v = IDL_RPCGetMainVariable(pClient, "DATA");
> printf("Array is: \n");
> d=(double *) v->value.arr->data;
> for (i=0;i<v->value.arr->n_elts;i++) printf("%lf\n",d[i]);
> IDL_RPCCleanup(pClient, TRUE);
> return 1;
> }
> ----------
>
> Output from running test1 program:
> ----------
> Array is:
> 0.000000
> 1.000000
> 2.000000
> 3.000000
> 4.000000
> 5.000000
> 6.000000
> 7.000000
> 8.000000
> 9.000000
> ----------
>
> Now, we try to follow the same pattern, but with a serverid. Start
> idlrpc with a serverid, so its main process looks as follows:
> www1 3606 1 0 18:02 ? 00:00:00
> /usr/local/rsi/idl_6.0/bin/bin.linux.x86/idlrpc -server=C2500001
>
> Test2 program source code:
> ----------
> #include <stdio.h>
> #include "idl_rpc.h"
>
> int main(int argc, char **argv)
> {
> CLIENT *pClient;
> int i;
> IDL_VPTR v;
> double *d;
>
> /* Initialize the Client */
> if((pClient = IDL_RPCInit((IDL_LONG)"C2500001", (char*)NULL)) ==
> (CLIENT*)NULL)
> {
> fprintf(stderr, "Can't register with IDL server.\n");
> exit(1);
> }
> /* initialize the data structure */
> IDL_RPCExecuteStr(pClient, "data=dindgen(10)");
>
> /* Get the data variable back from IDL */
> v = IDL_RPCGetMainVariable(pClient, "DATA");
> printf("Array is: \n");
> d=(double *) v->value.arr->data;
> for (i=0;i<v->value.arr->n_elts;i++) printf("%lf\n",d[i]);
> IDL_RPCCleanup(pClient, TRUE);
> return 1;
> }
> ----------
>
> Output from running test2 program:
> ----------
> clnttcp_create: RPC: Program not registered
> Can't register with IDL server.
> ----------
>
> Such error messages are similar to those we get from our web
> applications built from the same source code that worked on IRIX, so
> fixing this test case may help with our main problem. Do you have any
> suggestions?
>
> Thanks,
> webuser
Well, I don't know why your code works on sgi IRIX, it shouldn't. The main
problem is that the first argument to IDL_RPCInit is a long, not a string
cast to IDL_LONG. The second problem is that the server id you are using is
out of the allowed range (although this doesn't seem to pose a real
problem, the server id you are using results in a negative number for the
RPC program registration value). The range quoted in the EDG for the server
id is 0x20000000-0x3fffffff.
If you fix these two problems your code should work. E.g the code:
IDL_RPCInit(0x20000001L, (char*)NULL)
connects to a server started as:
$ idlrpc -server=20000001
--
Nigel Wade, System Administrator, Space Plasma Physics Group,
University of Leicester, Leicester, LE1 7RH, UK
E-mail : nmw@ion.le.ac.uk
Phone : +44 (0)116 2523548, Fax : +44 (0)116 2523555
|
|
|