title: JADE Platform Communication
body: <p>Basically I'm trying the same thing as asked here: <a href="https://stackoverflow.com/questions/21793308/passing-acl-messages-between-jade-remote-platforms">Passing ACL messages between jade remote platforms</a></p>
  
  <p>I have two programmes creating two main container and an agent respectively. I run both programmes on different machines and want to send a message from one agent to another. The answer suggested in the question linked to above does not work for me. The receiver side always throws a java.lang.OutOfMemoryError and the sender shows this:</p>
  
  <pre><code>jade.mtp.MTPException: Description: ResponseMessage is not OK
  </code></pre>
  
  <p>Sending a message if both agents run in different agent containers on different machines but in the same main container works, but that's not what I try to achieve.
  Hope you can help me.</p>
  
  <h2>Code</h2>
  
  <p><strong>Sender:</strong></p>
  
  <pre><code>public class Main {
  
  public static void main(String[] args) {
  
      Runtime runtime = Runtime.instance();
  
      Profile p = new ProfileImpl();
      p.setParameter(Profile.MAIN_HOST, "172.16.200.100");
      p.setParameter(Profile.MAIN_PORT, "1337");
      p.setParameter(Profile.CONTAINER_NAME,"Reality");
  
      AgentContainer agentContainer = runtime.createMainContainer(p);
  
      try {
          AgentController ac = agentContainer.createNewAgent("hitman",Agent47.class.getName(),null);
          ac.start();
          } catch (StaleProxyException e) {e.printStackTrace();}
      }
  }
  
  public class Agent47 extends Agent {
  
      private static final long serialVersionUID = 1L;
  
      @Override
      protected void setup() {
  
          ACLMessage msg = new ACLMessage(ACLMessage.INFORM); 
          AID dest = new AID("AgentSmith@Matrix",AID.ISGUID);
          dest.addAddresses("http://172.16.200.1:4242/acc");
          msg.addReceiver(dest);
          msg.setContent("Hello!");
          send(msg);
      }
  }
  </code></pre>
  
  <p><strong>Receiver:</strong></p>
  
  <pre><code>public class Main {
  
      public static void main(String[] args) {
          Runtime runtime = Runtime.instance();
  
          Profile p = new ProfileImpl();              
          p.setParameter(Profile.MAIN_HOST, "172.16.200.1");
          p.setParameter(Profile.MAIN_PORT, "4242");
          p.setParameter(Profile.CONTAINER_NAME,"Matrix"); 
  
          AgentContainer agentContainer = runtime.createMainContainer(p);
  
          try {
              AgentController ac = agentContainer.createNewAgent("AgentSmith",AgentSmith.class.getName(),null);
              ac.start();
          } catch (StaleProxyException e) {e.printStackTrace();}
      }
  }
  
  public class AgentSmith extends Agent {
  
      private static final long serialVersionUID = 1L;
  
      @Override
      protected void setup() {
  
          addBehaviour(new CyclicBehaviour(this){
  
              private static final long serialVersionUID = 1L;
  
              public void action() {
                   ACLMessage  msg = myAgent.receive();
                      if(msg != null){
  
                              String content = msg.getContent();
                              if (content != null) {
                                  System.out.println("Received Request from "+msg.getSender().getLocalName());
                                  System.out.println("Received Message : "+content);
                              }
  
                          }  
               }
          });
  
          System.out.println("Setup done!");
      }
  
  }
  </code></pre>