Hello,
I am trying to execute send and receive message code. The PC will send the message to Intel galileo processor. The code run for the first time but when I executed later, it didn't work. I dont know why???? .
Below are the Sender and Receiver codes. Please tell me whats going wrong with these codes.
Sender
import spade
class Sender(spade.Agent.Agent):
def _setup(self):
self.addBehaviour(self.SendMsgBehav())
print "Sender started!"
class SendMsgBehav(spade.Behaviour.OneShotBehaviour):
def _process(self):
msg = spade.ACLMessage.ACLMessage()
msg.setPerformative("inform")
msg.addReceiver(spade.AID.aid("b@IPaddress of galileo",["xmpp://b@IPaddress of galileo"]))
msg.setContent("testSendMsg")
self.myAgent.send(msg)
print "a has sent a message:"
print str(msg)
self.myAgent.stop()
a = Sender("a@IPaddress of PC","secret")
a.start()
Receiver
import spade
class Receiver(spade.Agent.Agent):
class RecvMsgBehav(spade.Behaviour.OneShotBehaviour):
def _process(self):
msg = self._receive(block=True,timeout=10)
print "b has received a message:"
print str(msg)
self.myAgent.stop()
def _setup(self):
template = spade.Behaviour.ACLTemplate()
template.setSender(spade.AID.aid("a@IPaddress of PC",["xmpp://a@IPaddress of PC"]))
t = spade.Behaviour.MessageTemplate(template)
self.addBehaviour(self.RecvMsgBehav(),t)
print "Receiver started!"
b = Receiver("b@IPaddress of galileo","secret")
b.start()