带有ACL的Jade代理协议



我想在两个代理(在不同的平台中(之间开发一个协议,例如在Agent1和Agent2:之间

1.Agent1 send a message to Agent2 with a nonce
2.Agent2 receive the nonce, make a mathematic operation and then send to Agent1
3.Agent1 receive the message and sent Agent2 an ACK

因此,我想创建一个名为doProtocol(Location destination,int nonce(的函数,并自动处理

我知道如何发送或接收信息,但我找不到如何同时发送或接收有人能帮我吗?

我会使用FIPA RequestInteraction。

代理1,添加行为AchieveReinition。在PrepareRequest中指定您的函数

prepareRequest(ACLmessage request)
{
request =  getNonceMsg();
return request;
}
handleInform(ACLmessage reply)
{
//acknowledge response if you want to.
}

代理2,添加行为AchieveRR应答器。在prepareResponse中指定您的函数

prepareResponse(ACLmessage reply)
{
response =  compileResponse(reply.getContent());
return response;
}

最新更新