Goto Chapter: Top 1 2 3 4 5 6 7 8 9 Bib Ind

### 7 Examples of SCSCP usage

In this chapter we are going to demonstrate some examples of communication between client and server using the SCSCP.

#### 7.1 Providing services with the SCSCP package

You can try to run the SCSCP server with the configuration file scscp/example/myserver.g. To do this, go to that directory and enter gap myserver.g. After this you will see some information messages and finally the server will start to wait for the connection. The final part of the startup screen may look as follows:


#I  Installed SCSCP procedure Factorial
#I  Installed SCSCP procedure WS_Factorial
#I  Installed SCSCP procedure GroupIdentificationService
#I  Installed SCSCP procedure IdGroup512ByCode
#I  Installed SCSCP procedure WS_IdGroup
#I  Installed SCSCP procedure WS_Karatsuba
#I  Installed SCSCP procedure EvaluateOpenMathCode
#I  Ready to accept TCP/IP connections at localhost:26133 ...
#I  Waiting for new client connection at localhost:26133 ...



See further self-explanatory comments in the file scscp/example/myserver.g. There also some test files in the directory scscp/tst/ supplied with detailed comments. First, you may use demonstration files, preliminary turning on the demonstration mode as it is explained in these files, or just executing step by step each command from scscp/tst/demo.g and scscp/tst/omdemo.g. Then you can try to use files scscp/tst/id512.g, scscp/tst/idperm.g and scscp/tst/factor.g for further tests of SCSCP services.

#### 7.2 Identifying groups of order 512

We will give an example guiding you through all steps of creation of your own SCSCP service.

The GAP Small Group Library does not provide identification for groups of order 512 using the function IdGroup:


gap> IdGroup( DihedralGroup( 256 ) );
[ 256, 539 ]
gap> IdGroup(DihedralGroup(512));
Error, the group identification for groups of size 512 is not available
called from
<function "unknown">( <arguments> )
called from read-eval loop at line 71 of *stdin*
you can 'quit;' to quit to outer loop, or
you can 'return;' to continue
brk>



However, the GAP package ANUPQ [GNO] has a function IdStandardPresented512Group that does this work as demonstrated below:


---------------------------------------------------------------------------
GAP code by  Greg Gamble <Greg.Gamble@uwa.edu.au> (address for correspondence)
[uses ANU pq binary (C code program) version: 1.9]
C code by  Eamonn O'Brien (http://www.math.auckland.ac.nz/~obrien)
Co-maintained by Max Horn <max.horn@math.uni-giessen.de>

For help, type: ?ANUPQ
---------------------------------------------------------------------------
true
gap> G := DihedralGroup( 512 );
<pc group of size 512 with 9 generators>
gap> F := PqStandardPresentation( G );
<fp group on the generators [ f1, f2, f3, f4, f5, f6, f7, f8, f9 ]>
gap> H := PcGroupFpGroup( F );
<pc group of size 512 with 9 generators>
gap> IdStandardPresented512Group( H );
[ 512, 2042 ]



The package ANUPQ requires UNIX environment and it is natural to provide an identification service for groups of order 512 to make it available for other platforms.

Now we need to decide how the client will transmit a group to the server. Can we encode this group in OpenMath? But there is no content dictionary for PcGroups. Should we convert it to a permutation representation to be able to use existing content dictionaries? But then the resulting OpenMath code will be not compact. However, the SCSCP protocol provides enough freedom for the user to select its own data representation, and since we are linking together two copies of the same system, we may use the pcgs code to pass the data to the server (see CodePcGroup (Reference: CodePcGroup).

First we create a function which accepts the integer number that is the code for pcgs of a group of order 512 and returns the number of this group in the GAP Small Groups library:


IdGroup512ByCode := function( code )
local G, F, H;
G := PcGroupCode( code, 512 );
F := PqStandardPresentation( G );
H := PcGroupFpGroup( F );
return IdStandardPresented512Group( H );
end;



After such function was created on the server, we need to make it "visible" as an SCSCP procedure:


gap> InstallSCSCPprocedure("IdGroup512", IdGroup512ByCode );
InstallSCSCPprocedure : procedure IdGroup512 installed.



Note that this function assumes that the argument is a valid code for some group of order 512, and we wish the client to make it sure that this is the case. To do this, and also for the client's convenience, we provide the client's counterpart for this service. Here the group must be a pc-group of order 512, otherwise an error message will appear.


gap> IdGroup512 := function( G )
>    local code, result;
>    if Size( G ) <> 512 then
>      Error( "G must be a group of order 512 \n" );
>    fi;
>    code := CodePcGroup( G );
>    result := EvaluateBySCSCP( "IdGroup512ByCode", [ code ],
>                               "localhost", 26133 );
>    return result.object;
> end;;



Now the client can call the function IdGroup512, and the procedure of getting result is as much straightforward as using IdGroup for those groups where it works:


gap> IdGroup512(DihedralGroup(512));
[ 512, 2042 ]


Goto Chapter: Top 1 2 3 4 5 6 7 8 9 Bib Ind

generated by GAPDoc2HTML