我想在两个代理之间(在不同的平台上)开发一个协议,例如在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 destiny,int nonce)的函数,并自动执行该过程
我知道如何发送或接收消息,但我找不到如何同时做到这一点,任何人可以帮助我?
发布于 2020-05-01 12:23:31
我会使用FIPA-RequestInteraction。
代理1,添加行为AchieveREInitiation。在PrepareRequest中指定您的函数
prepareRequest(ACLmessage request)
{
request = getNonceMsg();
return request;
}
handleInform(ACLmessage reply)
{
//acknowledge response if you want to.
}代理2,添加行为AchieveREResponder。在prepareResponse中指定您的函数
prepareResponse(ACLmessage reply)
{
response = compileResponse(reply.getContent());
return response;
}https://stackoverflow.com/questions/61164106
复制相似问题