-# reset iterators
-$it_port=4000;
-$it_host=0;
-
-for (my $i=0; $i<$nb_hosts; $i++) {
- if (!length($source) || $source == $i) {
- print " <process host=\"".$host[$it_host]."\" function=\"sender\">\n";
- print $receivers;
- print " </process>\n";
- }
-
- $it_host ++;
- if ($it_host == scalar @host) {
- $it_host=0;
- $it_port++;
- }
+if(length($source)) {
+ print " <process host=\"".$host[$source % (scalar @host)].
+ "\" function=\"sender\">\n";
+ for my $r (@receivers) {
+ print " <argument value=\"$r\"/>\n";
+ }
+ print " <argument value=\"$size_msg\"/>\n";
+ print " </process>\n";
+} else {
+ my $i = 0;
+ for my $r (@receivers) {
+ my ($h, $p) = split(":", $r);
+ print " <process host=\"".$h."\" function=\"sender\">\n";
+ for (my $j = 0; $j < $nb_hosts; $j++) {
+ my $r2 = $receivers[($i + $j) % ($nb_hosts)];
+ print " <argument value=\"$r2\"/>\n";
+ }
+ print " <argument value=\"$size_msg\"/>\n";
+ print " </process>\n";
+ $i++;
+ }