Code in C . Create a hangman game in C using named pipes and processes. Thegame's server
Question:
Code in C .
Create a hangman game in C using named pipes and processes. Thegame's server is ran through using gameserver.c and the client isran using gameclient.c. I have provided the pseudocode for eachbelow.
gameserver.c should run the server functionality. It loads allthe dictionary words from dictionary.txt as part of thesetup and waits for input through the named pipe /tmp/NETID. Foreach request comes through the pipe, server should fork a process -Child process should send its own unique pipename to the client andstart the hangman game! Parent process proceeds to wait for newrequests. This setup enables the server to support any # of clientsin parallel!
gameclient.c is a thin client program that gets the user inputand passes to the server and shows the reply in the screen. Here isa sample I/O for the client.
Pseudocode for gameclient.c
/* make up unique pipename
* send it to the server
* get another unique pipename from the server
* repeat
* get the starred word from the new pipe
* display to the user
* get the user's guess letter
* send to the server
*/
Pseudocode for gameserver.c
/*
* read dictionary file to array of words & get ready to playthe hangman!
* wait for a request to come in (unique pipename)
* respond with another unique pipename
* send a bunch of stars (indicating the word length)
* fork() to enable games to proceed in parallel.
* for each guess the client sends in, respond with a message
* and send updated display word.
* /
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill