Objective:

Create a word count server that can do the following: converts first alphabet of a given sentence to upper-case and converts rest of the alphabets to lower-case, counts the number of spaces, counts the number of alphabets, and finally counts the number of vowels in a given sentence.

Requirements:

  • Create a C-based client-server architecture using TCP sockets
  • The word count server should run on cse02.cse.unt.edu machine and the client should run on cse03.cse.unt.edu machine
  • The word count server should be able to accept and service at least one client's request
  • The word count server should be able to convert first alphabet in a given sentence to upper-case alphabet and convert rest of the alphabets to lower-case and print the converted sentence on the client side
  • The word count server should be able to count the number of spaces in a given sentence and print the number of spaces on the client side
  • The word count server should be able to count the number of alphabets in a given sentence and print the number of alphabets on the client side
  • The word count server should be able to count the number of vowels in a given sentence and print the number of vowels on the client side
  • The word count server should be able to quit when a quit expression is given as input from the client side
  • Do not use any ready-made or in-built functions to directly count spaces, alphabets, vowels, or to convert the case
  • Do not use any Linux shell commands or code from the internet. You could use pre-defined functions from C string library.

Procedure:

1. Create a C-based server that can accept at least one client's request using TCP sockets

2. Make sure the word count server runs on cse02.cse.unt.edu and the format to start the word count server as follows

./wcserver < port_number >

where wcserver is the word count server executable and port_number is the port number on which the word count server listens

3. Create a C-based client that can connect to the word count server using TCP sockets

4. Make sure the client runs on cse03.cse.unt.edu and connects the word count server. The user can send the sentence using the below format

./client < port_number >

input:

where client is the client executable, port_number is the port number on which the client connects the server and input is the sentence input to the server

5. Once the word count server gets a sentence from the client, it converts the first alphabet of the given sentence to upper-case alphabet and converts rest of the alphabets to lower-case and sends the converted sentence to the client

6. It also finds the number of spaces, number of alphabets, and the number of vowels in the input sentence and replies it to the client

7. The word count server quits when a quit expression is given as input

8. Assume that the given sentence will not be more than 255 characters, every word will be separated with a single space, and will have punctuations

Client-side input/output example:

./client 1234
input: hello world!
output: Hello world!
spaces: 1
alphabets: 10
vowels: 3
input: HOW ARE YOU?
output: How are you?
spaces: 2
alphabets: 9
vowels: 5
input: quit
cya!
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.