MCAclMessage

Examples of commonly used MCAclMessage operations:

Create a new, blank ACL message:

 MCAclMessage tmp = new MCAclMessage();
 tmp.New();

Set the performative field:

 tmp.SetPerformative(MCAclMessage.MC_FipaPerformative_e.FIPA_INFORM);

Set the sender:

 tmp.SetSender("agency", "http://" + host + ":" + 
     localport.ToString() + "/acc");

Add an alternate reply-to field:

 tmp.AddReplyTo("mobagent2", "http://" + host + ":" + 
     localport.ToString() + "/acc");

Add a receiver to the message:

 tmp.AddReceiver("mobagent1", "http://" + host + ":" + 
     localport.ToString() + "/acc");

Set the content of the message:

 tmp.SetContent("This is content. Yay!");

Finally, send and destroy the message:

 Agency.AclSend(tmp);
 tmp.Destroy();

Note that messages contain a pointer to allocated unmanaged memory and need to be disposed of after they are used. The agency creates a copy of the message when it is sent, and therefore the MCAclMessage object is no longer needed.


Generated on Thu Nov 13 14:22:58 2008 for Mobile-C by  doxygen 1.5.5