Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Split gtut in several pages, add lesson 5
[simgrid.git] / doc / gtut-tour-3-args.doc
1
2 /** 
3 @page GRAS_tut_tour_args Lesson 3: Passing arguments to the processes (in SG)
4
5 The most problematic issue with the code of previous lesson is that it does
6 not work in RL since we hardcoded the server hostname in the client code. We
7 will thus learn you how to pass arguments to your processes to overcome this
8 situation.
9
10 \section GRAS_tut_tour_args_use Using command line arguments from user code
11
12 In RL, the situation is quite simple: we just have to use the command line
13 arguments as we would do in a usual C program. In the server, only change
14 concern the opennong of the master socket:
15 \dontinclude 3-args.c
16 \skip gras_socket_server
17 \until gras_socket_server
18
19 In the client, we only need to change the way we open the client socket:
20 \skip gras_socket_client
21 \until gras_socket_client
22
23 The rest of the program remains inchanged. 
24
25 \section GRAS_tut_tour_args_sg Passing command line arguments in deployment files
26
27 At this point, the problem is to pass arguments to the processes in SG.
28 Fortunately, it is quite simple. You just have to edit your deployment file
29 so that it reads: \include 3-args.xml
30 The syntax should be self-explanatory at this point.
31
32 \section GRAS_tut_tour_args_recap Recaping everything together
33
34 The whole program now reads:
35 \include 3-args.c
36
37 And here is the output:
38 \include 3-args.output
39
40 \ref GRAS_tut_tour_callbacks
41
42 */