Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add FindNS3 module to cmake.
[simgrid.git] / doc / gtut-tour-03-args.doc
1
2 /** 
3 @page GRAS_tut_tour_args Lesson 3: Passing arguments to the processes (in SG)
4
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
9    
10 <hr>
11
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
15 situation.
16
17 \section GRAS_tut_tour_args_use Using command line arguments from user code
18
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
25
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
29
30 The rest of the program remains inchanged. 
31
32 \section GRAS_tut_tour_args_sg Passing command line arguments in deployment files
33
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.
38
39 \section GRAS_tut_tour_args_recap Recaping everything together
40
41 The whole program now reads:
42 \include 03-args.c
43
44 And here is the output:
45 \include 03-args.output
46
47 Go to \ref GRAS_tut_tour_callbacks
48
49 */