4. Message Formats

We will describe the message format used in libnjaim briefly, you could download the udpserver freely from http://sourceforge.net/projects/njaim

Client can send one of four kinds of message to udpserver (When we talk about proper string, we mean a string without space and '=') :

Client can receive one of four kinds of message from udpserver :

Since UDP is not reliable, sometimes we want to be assured that the message is successfully received by peer, we may require the peer to acknowledge the message. This can be done by sending messages of type "ACK", with an empty TEXT field.

Here is a common scenario :

  1. Alice sends : "TYPE=CUSTOM NAME=Bob TEXT=hello".

  2. Alice receives : "TYPE=OK PEER=Bob/1.2.3.4:5".

  3. Bob receives : "TYPE=CUSTOM NAME=Alice/4.3.2.1:5 TEXT=hello".

  4. Bob acknowledges by sending : "TYPE=ACK NAME=Alice".

  5. Bob receives : "TYPE=OK PEER=Alice/4.3.2.1:5".

  6. Alice receives : "TYPE=ACK PEER=Bob/1.2.3.4:5".