I need to pass an ACL message between 2 jade platforms. I implemented my code to pass messages between agents in the same container. That works fine. But I could not develop that code to pass messages between remote platforms.
Below is what I implemented for the agents in the same container. In the sender agent code the result[] only gets the agents in the same platform.
What am I missing? Is there any method to get the list of agents in the remote platform?
Sender agent
DFAgentDescription temp = new DFAgentDescription();
try
{
//DFAgentDescription[] result = DFService.search(this,temp);
SearchConstraints sc = new SearchConstraints();
DFAgentDescription[] result=DFService.search(this,temp,sc);
ACLMessage acl = new ACLMessage(ACLMessage.REQUEST);
System.out.println("Agents: ");
for(int i=0;i<result.length;i++)
{
if(result[i].getName().getLocalName().equalsIgnoreCase("R1"))
{
acl.addReceiver(result[i].getName());
System.out.print(" , "+result[i].getName().getLocalName());
}
}
acl.setContent("Hello...");
this.send(acl);
System.out.println("Message Sent...");
}
catch(FIPAException e)
{
System.out.println("Error !: "+e);
}
Receiver agent
addBehaviour(new CyclicBehaviour()
{
public void action()
{
ACLMessage msg = myAgent.receive();
if(msg != null)
{
if(msg.getPerformative()== ACLMessage.REQUEST)
{
String content = msg.getContent();
if ((content != null))
{
System.out.println("Received Request from "+msg.getSender().getLocalName());
System.out.println("Received Message : "+content);
}
else
{
block();
}
}
}
else
{
block();
}
}
});
Try this
Instead my local IP use your own IP or hostname.