view src/fdl/old/test/metaTransfer/TestSend.java @ 122:ad73eacf560a default tip

remove warning
author e095732
date Thu, 07 Feb 2013 22:32:26 +0900
parents 3b877c9a44f5
children
line wrap: on
line source

package fdl.old.test.metaTransfer;

import java.io.IOException;
import java.nio.ByteBuffer;

import fdl.FederatedLinda;
import fdl.PSXLinda;

public class TestSend extends Thread {
	PSXLinda psxsend;
	FederatedLinda fdlsend;
	
	public void run(){
		int id = 10;
		int port = 10001;
		boolean connect = true;
		String host = "127.0.0.1";
		ByteBuffer send = ByteBuffer.allocate(1024);
		send.putInt(12);
		send.flip();
		while(connect){
		try {
		sendData(id, port, host, send);
		connect = false;
		} catch(IOException e) {
			try {
				Thread.sleep(40);
			} catch (InterruptedException e1) {
				e1.printStackTrace();
			}
		}
		
		}
	}

	private void sendData(int id, int port, String host, ByteBuffer send) throws IOException {
		fdlsend = FederatedLinda.init();

			psxsend = fdlsend.open(host,port);
			System.out.println("Connect Host1");
			psxsend.out(id, send);
			fdlsend.sync(1);
			System.out.println("Send Data");

	}
	
}