3 @page GRAS_tut_tour_args Lesson 3: Passing arguments to the processes (in SG)
5 \section GRAS_tut_tour_args_toc Table of Contents
6 - \ref GRAS_tut_tour_args_use
7 - \ref GRAS_tut_tour_args_sg
8 - \ref GRAS_tut_tour_args_recap
12 The most problematic issue with the code of previous lesson is that it does
13 not work in RL since we hardcoded the server hostname in the client code. We
14 will thus learn you how to pass arguments to your processes to overcome this
17 \section GRAS_tut_tour_args_use Using command line arguments from user code
19 In RL, the situation is quite simple: we just have to use the command line
20 arguments as we would do in a usual C program. In the server, only change
21 concern the opennong of the master socket:
22 \dontinclude 03-args.c
23 \skip gras_socket_server
24 \until gras_socket_server
26 In the client, we only need to change the way we open the client socket:
27 \skip gras_socket_client
28 \until gras_socket_client
30 The rest of the program remains inchanged.
32 \section GRAS_tut_tour_args_sg Passing command line arguments in deployment files
34 At this point, the problem is to pass arguments to the processes in SG.
35 Fortunately, it is quite simple. You just have to edit your deployment file
36 so that it reads: \include 03-args.xml
37 The syntax should be self-explanatory at this point.
39 \section GRAS_tut_tour_args_recap Recaping everything together
41 The whole program now reads:
44 And here is the output:
45 \include 03-args.output
47 Go to \ref GRAS_tut_tour_callbacks