view src/test/java/alice/daemon/MulticastStartCodeSegment.java @ 545:074c6716f906 dispose

add AliceDeamon on paramater. not working TestLocalAlice
author Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
date Tue, 04 Aug 2015 16:24:59 +0900
parents 0832af83583f
children 15eeb439830c
line wrap: on
line source

package alice.daemon;

import alice.codesegment.CodeSegment;
import alice.datasegment.DataSegment;
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");

            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");
        } 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");

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

}