view src/test/java/alice/daemon/MulticastStartCodeSegment.java @ 547:e91a574b69de dispose

remove index
author Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
date Tue, 18 Aug 2015 16:15:17 +0900
parents 15eeb439830c
children
line wrap: on
line source

package alice.daemon;

import alice.codesegment.CodeSegment;
import alice.datasegment.MulticastDataSegmentManager.SocketType;

public class MulticastStartCodeSegment extends CodeSegment {

    private Config conf;
    public MulticastStartCodeSegment(Config conf) {
        this.conf = conf;
    }

    @Override
    public void run() {
        aliceDaemon.dataSegment.connectMulticast("multicast",conf.MCSTADDR, conf.localPort, conf.nis, MulticastTest.type);
        if (MulticastTest.type == SocketType.Both) {
            // in this case "multicast" key mean local.
            MulticastIncrement cs = new MulticastIncrement();
            cs.num.setKey("multicast","num", this);

            ods.put("multicast", "num", 0);
        } else if (MulticastTest.type == SocketType.Receiver){
            aliceDaemon.dataSegment.connectMulticast("multicast1", "224.0.0.2", conf.localPort+1, conf.nis, SocketType.Sender);
            ReceiveInteger cs = new ReceiveInteger();
            cs.num.setKey("num", this);
        } else if (MulticastTest.type == SocketType.Sender){
            aliceDaemon.dataSegment.connectMulticast("multicast1", "224.0.0.2", conf.localPort+1, conf.nis, SocketType.Receiver);
            ReceiveString cs = new ReceiveString();
            cs.str.setKey("str", this);

            for (int i=0;i < 11; i++)
                ods.put("multicast", "num", i);
        }
    }

}