[英]Protocol on Jade Agents with ACL
I wanted to develop a protocol between two agents (in different platforms), for example between Agent1 and Agent2:我想在两个代理之间(在不同平台上)开发一个协议,例如在 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
so i want to create a function called for example doProtocol(Location destiny, int nonce) and do that process automatically所以我想创建一个 function 称为 doProtocol(Location fortune, int nonce) 并自动执行该过程
I know how to send or receive messages but i cant find how to do that simultaneously Anyone can help me?我知道如何发送或接收消息,但我找不到如何同时做到这一点任何人都可以帮助我吗?
I would use FIPA-RequestInteraction.我会使用 FIPA-RequestInteraction。
Agent 1, add behaviour AchieveREInitiation.代理1,添加行为AchieveREInitiation。 In the PrepareRequest specify your function
在 PrepareRequest 中指定您的 function
prepareRequest(ACLmessage request)
{
request = getNonceMsg();
return request;
}
handleInform(ACLmessage reply)
{
//acknowledge response if you want to.
}
Agent 2, add behaviour AchieveREResponder.代理2,添加行为AchieveREResponder。 In the prepareResponse specify your function
在 prepareResponse 中指定您的 function
prepareResponse(ACLmessage reply)
{
response = compileResponse(reply.getContent());
return response;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.