368
|
1 package alice.daemon;
|
|
2
|
|
3 import alice.codesegment.CodeSegment;
|
508
|
4 import alice.datasegment.DataSegment;
|
|
5 import alice.datasegment.MulticastDataSegmentManager.SocketType;
|
368
|
6
|
|
7 public class MulticastStartCodeSegment extends CodeSegment {
|
|
8
|
508
|
9 private Config conf;
|
|
10 public MulticastStartCodeSegment(Config conf) {
|
|
11 this.conf = conf;
|
|
12 }
|
|
13
|
419
|
14 @Override
|
|
15 public void run() {
|
508
|
16 DataSegment.connectMulticast("multicast",conf.MCSTADDR, conf.localPort, conf.nis, MulticastTest.type);
|
|
17 if (MulticastTest.type == SocketType.Both) {
|
|
18 // in this case "multicast" key mean local.
|
|
19 MulticastIncrement cs = new MulticastIncrement();
|
|
20 cs.num.setKey("multicast","num");
|
419
|
21
|
508
|
22 ods.put("multicast", "num", 0);
|
|
23 } else if (MulticastTest.type == SocketType.Receiver){
|
|
24 DataSegment.connectMulticast("multicast1", "224.0.0.2", conf.localPort+1, conf.nis, SocketType.Sender);
|
|
25 ReceiveInteger cs = new ReceiveInteger();
|
|
26 cs.num.setKey("num");
|
|
27 } else if (MulticastTest.type == SocketType.Sender){
|
|
28 DataSegment.connectMulticast("multicast1", "224.0.0.2", conf.localPort+1, conf.nis, SocketType.Receiver);
|
|
29 ReceiveString cs = new ReceiveString();
|
|
30 cs.str.setKey("str");
|
|
31
|
|
32 for (int i=0;i < 11; i++)
|
|
33 ods.put("multicast", "num", i);
|
|
34 }
|
419
|
35 }
|
368
|
36
|
|
37 }
|