Mercurial > hg > FederatedLinda
diff src/fdl/test/metaTransfer/Ring/TestSend.java @ 53:629b6cfbd37f
metaprotocol ring
author | axmo |
---|---|
date | Mon, 19 Jan 2009 17:49:14 +0900 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/fdl/test/metaTransfer/Ring/TestSend.java Mon Jan 19 17:49:14 2009 +0900 @@ -0,0 +1,47 @@ +package fdl.test.metaTransfer.Ring; + +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"); + + } + +}