コード例 #1
0
  /** @param init */
  private void handleChannelInit(ChannelInit init) {
    try {
      init.go();
    } catch (AppiaEventException e) {
      e.printStackTrace();
    }
    channel = init.getChannel();

    try {
      // sends this event to open a socket in the layer that is used has
      // perfect
      // point to point
      // channels or unreliable point to point channels.
      RegisterSocketEvent rse = new RegisterSocketEvent(channel, Direction.DOWN, this);
      rse.port = ((InetSocketAddress) processes.getSelfProcess().getSocketAddress()).getPort();
      rse.localHost =
          ((InetSocketAddress) processes.getSelfProcess().getSocketAddress()).getAddress();
      rse.go();
      ProcessInitEvent processInit = new ProcessInitEvent(channel, Direction.DOWN, this);
      processInit.setProcessSet(processes);
      processInit.go();
    } catch (AppiaEventException e1) {
      e1.printStackTrace();
    }
    System.out.println("Channel is open.");
  }
コード例 #2
0
 /** @param event */
 private void handleBCast(SendableEvent event) {
   try {
     event.go();
   } catch (AppiaEventException e) {
     e.printStackTrace();
   }
 }