Running the Aceclient

Running the Aceclient


Running the Aceclient (c version)

The syntax is:

    aceclient server -port <RPCPN> -time_out time_out_in_seconds
You must know the RPCPN (rpc program number) of the server before you attempt to connect. If no response is received from the server in time_out_in_seconds then a null response is returned.


Running the Aceclient (perl version)

In order to communicate with an aceserver then perl must be recompiled (or compiled if you do not have it on you system) with the Aceclient extensions. These directions are for a statically linked extension. A dynamically linked extension is possible, but you would need to read the perlapi documentation to do this.

Compiling perl 5.001 to support the perl ace client functionality

  1. Prerequisites

  2. Make the aceclient. To do this you need the full acedb40 distribution. See the instructions for how to make acedb. If you just do a 'make' then it will be made by default. You could also just do a 'make aceclient'

  3. In the bin.$ACEDB_MACHINE directory (e.g. bin.SOLARIS_4_RELEASE) create an archive file: the command is 'ar cr libacecl.a aceclientlib.o rpcace_clnt.o rpcace_xdr.o'.

  4. In the $ACEDB_SRC/wrpc directory, do a 'uudecode pacecl.tar.uu'. This will produce a file called pacecl.tar.

  5. Change directory to the perl5.001m source directory. cp $ACEDB_SRC/wrpc/pacecl.tar to this directory and do a 'tar xvf pacecl.tar'. This should make an ext/Aceclient directory with all the necessary files.

  6. cp ./ext/Aceclient/aceclient.h .

  7. If you have made perl before copy your perl executable to a safe place and do a 'make clean'.

  8. Make perl as you normally would (i.e. do a ./Configure and then a make).

  9. If everything went well then you should have a new perl executable which understands how to talk to an aceserver.

  10. An example client (pacecl.pl) is provided in the ./ext/Aceclient/ directory. The syntax is 'pacecl.pl <host> <rpcpn>' where rpcpn is the rpc program number of the aceserver. The first line of this file should be edited to point to your perl executable which has the Aceclient extensions.

Possible problems:

If the compile complains that can't find $ACEDB_SRC/bin.$ACEDB_MACHINE/libacecl.a (e.g. Solaris 2.4) then edit the ext.libs file in the perl source directory and replace this line with the full pathname of this file.

If the compiler complains it can't find /bin./libacecl.a then $ACEDB_SRC and $ACEDB_MACHINE are not set.

If pacecl.pl complains that it can't find Aceclient.pm then PERL5LIB is not set or points to the wrong directory. It must point to (your perl source directory)/lib.

Other compile time errors make be caused by the static_ext variable not being set in makefile in the perl source root.

If you continue to have problems then try a make clean and start again.

NOTE: This has only be tested extensively on Sparc/SOLARIS 2.4. It will be tested soon on DEC Alpha/OSF and Silicon Graphics/IRIX 6.0.1. Perl executables which provided soon for all three of these platforms in the near future. These will be announced on the What's New page on http://probe.nalusda.gov .

Bugs and such should be send to gig@gig.usda.gov. We would also be interested in hearing from people who have ported Perl with aceclient functionality to other platforms.

WARNING:
The perl client as created with perl 5.001 had memory leaks and if it is run for long periods of time may eat up too much memory. It is unsure at present whether this is a perl problem or a problem with the aceclient extensions. This seems to be fixed with perl 5.001m.

New Perl Functions for Communicating with the Aceserver

1. $ace_handle = openServer($machine, $rpc_pn, $time_out_in_seconds)
Example:
$ace_handle = openServer("nonesuch.nalusda.gov", 211312, 600);
You must know the RPC program number of the server (211312 in this case).

2. closeServer($ace_handle);

3. ($status, $answer) = askServer($ace_handle, $command, $chunk_size_in_KB);
Example:
($status, $answer) = askServer($ace_handle, 'find locus Adh1*', 10);
Things to note:
$status will be 0 if the serve completed the command. $status will be set to -1 if the server has more data (which can be retrieved with the 'more' command). $status will be set to something else if there is an error (more complete error reporting is in the works).
A chunk size of 5-10KB seems to be the most efficient. If this is set to 0 then the server will send as much data as possible (the server, however, may limit chunk size so you must still check $status).