[Need Help]Creating Messenger using C Assignment
Can anybody help me coz i need to finish this assignment as soon as possible..
In this exercise you will create a simplified version of a live messenger service. It delivers text messages from users to other users, provided both sender and receiver are connected to the system at that point in time. Message delivery is according to the pull paradigm, that is, messages have to be fetched by users; the service does not send a notification about the arrival of a message.
There are five operations the users can activate: (i) connect to the system (ii) disconnect (iii) deposit a message for a connected user (iv) retrieve a message from a connected user and (v) check if a particular user is connected. For privacy reasons, e.g. to avoid spamming, you cannot obtain a list of all connected users. In order to send a message, you need to know the recipients ID.
Your task is to implement the client and server modules. The client module takes input from the user, and provides responses. On one hand, it accepts messages and addressees and forwards them to the service; on the other hand, it fetches messages from the server and displays it to the user. A client module can handle multiple users with different IDs simultaneously.
The senders and recipients IDs must be included in the message. The user IDs are integer numbers, the messages are in plain text format and can contain any printable character. You need to ensure that messages are not longer than the available buffer space. When a message is deposited, the server module records the current time together with the message. When retrieving a message, the server tells the client how long the message
was waiting before being picked up.
Communication is via RPC. In case there is an error on the server side or on the client side, an error message will be displayed to the user and the current operation will be aborted. Client and server are as follows.
Client: It repeatedly requests a string to be entered by the user (use fgets). Each line typed at the client is to be interpreted as a command, a user ID and data if any. This requires the expression to be separated (e.g. using sscanf) into different arguments having the type of string, non-negative integer or character.
Server: This must implement the five remote procedures connect, disconnect, deposit, retrieve and inquire. They will take the input arguments, and perform the required operation.
You should use the following definition of an RPC message:
typedef struct
{ enum {Request, Reply} messageType; /* same size as an unsigned int */
unsigned int ClientId; /* unique client identifier */
unsigned int RequestID; /* request identifier (counter) */
unsigned int RPCId; /* universally unique identifier (UUID) */
/*RPCID is unique across the whole system */
unsigned int procedureId; /* e.g.(1,2,3,4) */
unsigned int arg1[]; /* argument/ return parameter */
unsigned int arg2; /* argument/ return parameter */
unsigned int arg3; /* argument/ return parameter */
char arg4[]; /* argument/ return parameter */
} RPCMessage; /* each int (and unsigned int) is 32 bits = 4 bytes */
The arg fields can be used for operation arguments or returned value and status. If you need to modify the above RPC message structure, you have to explain all the reasons. Unsatisfactory explanations will result in mark deduction.
Other matters to be addressed:
Both client and server should make use of the messageType field of the RPCmessage structure to test that Requests and Replies are not confused.
The client should generate a new RPCId for each call; and the server should copy the RequestId from the Request message to the reply message so that the client can test that the replies correspond to the requests.
The server may reject any operation from the client at its discretion. The client must be able to respond accordingly under all circumstances.
In general, your program should behave sensibly under error conditions.

