首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >具有ACL的Jade代理协议

具有ACL的Jade代理协议
EN

Stack Overflow用户
提问于 2020-04-12 05:45:14
回答 1查看 25关注 0票数 0

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

代码语言:javascript
复制
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)的函数,并自动执行该过程

我知道如何发送或接收消息,但我找不到如何同时做到这一点,任何人可以帮助我?

EN

回答 1

Stack Overflow用户

发布于 2020-05-01 12:23:31

我会使用FIPA-RequestInteraction。

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

代码语言:javascript
复制
prepareRequest(ACLmessage request)
{
  request =  getNonceMsg();
  return request;
}
handleInform(ACLmessage reply)
{
  //acknowledge response if you want to.
}

代理2,添加行为AchieveREResponder。在prepareResponse中指定您的函数

代码语言:javascript
复制
prepareResponse(ACLmessage reply)
{
  response =  compileResponse(reply.getContent());
  return response;
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61164106

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档