So guys, now let us discuss what are different types of messages we need to prepare in this project
so our application or project exchange messages can be structured as follows.
So you can use this one unified structure in order to represent all of the messages types.
The first member of this message is the message ID, right?
So this is the message ID.
This message ID could represent put forward.
Get forward.
What ex put reply ex or get reply ex message.
So you need to define these values as enumerations or constants in your project.
The rest of the fields in this message are very obvious that they represent the value of key, the value
of X and the IP address and TCP port number.
The IP address and TCP port number together combines the information of the originator of put or get
request.
Now this table shows that for a given particular message type, what should be the values of the rest
of the fields of this message?
For example, if your message type is put forward, then it should have the value of key and the IP
address and TCP port number of put request originator.
The value which are not specified can be simply initialized to zero in a put forward message.
You have no business to access the value of X because the value of x is not defined for a put forward
message.
The same goes with get forward.
What x put reply x and get reply X message.
Please note that unsigned int address that is this member of this structure can be encoded as unsigned
integer equivalent of IP address the unsigned integer equivalent of IP address.
127.0.0.1.
You can google IP address calculator to compute the integer equivalent of this IP address.