Hi everyone, Iam new in C programming and I need some help solving this program, this dosent have to do anything with network programming. This is just basically a C language simulation program between clients and a server. There is a function for server and a function for clients that i need to do... this is where iam stuck i need to apply queues but i need to know where? can some one give me hints...
this is the program requirements are:
Code:
In c programming create a Server process and a Client process.
The Client will randomly generate some text and send it to the Server
the Server will then echo the text to all Clients including the name of
the Client sending the message. This will then be displayed by each of
the Clients that are attached to the Server.
Server should continuously loop and accept messages from Clients
and then echo them. Each client gets a unique name which will be passed to
the server at the time when the connection is established.
Run one server and ten clients for at least 100 distinct messages from all clients.
Typical output may look like:
Client1 sends: abba
Client3 receives: From Client1: abba
Client4 receives: From Client1: abba
etc... smile
or... if you wish...
Client1 sends: abba
Client3 receives: Client1> abba
Client4 receives: Client1> abba
etc... smile
(remember that more than one message may pile up on one client; therefore, you need
to allow a queue for each client... similarily, for the server)
This is what i have so far iam in stage 0.5 right now. Can some of you give me some hints in how to continue develop this program. Thank you very much
Code:
#include<stdio.h>
main()
//void client;
{
char message[30];
printf("THE SIMULATION OF A CLIENT AND SERVENT PROGRAM\n\n");
printf("Client1 Sends: ");
scanf("%s",&message);
printf("Client2 Receives: %s",message);
//void client()
//{
//}
//void server()
//{
//}
return 0;
}