Package dijjer.io.xfer

Examples of dijjer.io.xfer.BlockTransmitter


    byte[] block = new byte[1024 * 256];
    for (int x = 0; x < block.length; x++) {
      block[x] = (byte) x;
    }
    PartiallyReceivedBlock prb1 = new PartiallyReceivedBlock(256, 1024, block);
    final BlockTransmitter bt = new BlockTransmitter(usm1, p2, 0, prb1);
    (new Thread() {

      public void run() {
        try {
          bt.send();
        } catch (Exception e) {
          throw new RuntimeException(e);
        }
      }
    }).start();
    PartiallyReceivedBlock prb2 = new PartiallyReceivedBlock(256, 1024);
    final BlockReceiver br = new BlockReceiver(usm2, p1, 0, prb2);
    final BlockTransmitter bt2 = new BlockTransmitter(usm2, p3, 0, prb2);
    PartiallyReceivedBlock prb3 = new PartiallyReceivedBlock(256, 1024);
    final BlockReceiver br2 = new BlockReceiver(usm3, p2, 0, prb3);
    (new Thread() {

      public void run() {
        try {
          br.receive();
        } catch (Exception e) {
          throw new RuntimeException(e);
        }
      }
    }).start();
    (new Thread() {

      public void run() {
        try {
          bt2.send();
        } catch (Exception e) {
          throw new RuntimeException(e);
        }
      }
    }).start();
View Full Code Here


    }
  }

  protected void forwardData(Peer dest, PartiallyReceivedBlock prb, int uid, LinkedList forwarders, boolean wasCached) {
    _usm.send(dest, DMT.createRequestSuccessful(uid, _rt.getPeer(), wasCached));
    BlockTransmitter bt = new BlockTransmitter(_usm, dest, uid, prb);
    bt.send();
    synchronized (forwarders) {
      for (Iterator i = forwarders.iterator(); i.hasNext();) {
        Peer p = (Peer) i.next();
        _rt.addPeer(p);
      }
View Full Code Here

TOP

Related Classes of dijjer.io.xfer.BlockTransmitter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.