Mercurial > hg > FederatedLinda
view src/fdl/test/metaTransfer/TestSend.java @ 71:0352536c33fa
(example: writer) get linda server addr from commandline arg.
author | kazz@e065701.local |
---|---|
date | Fri, 23 Oct 2009 14:11:07 +0900 |
parents | 629b6cfbd37f |
children |
line wrap: on
line source
package fdl.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"); } }