Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this programming assignment, you will implement a client process and a server process, respectively, to communicate with each other. You can use either C

In this programming assignment, you will implement a client process and a server process, respectively, to
communicate with each other.
You can use either C, C++, or Java, or Python to program this project.
Your client program and server program should operate as follows. Your server runs first on a terminal waiting
for your client to connect. The server should use a server port number choosing by yourself and must be bigger
than 1024(smaller than 65535). Your client runs on another terminal.
Objective---Simple math calculator: The client program repeatedly requires the user to input a basic math
computing question, which will be sent to server program where it will be computed. The result is sent back by
the server program and the client program displays it out.
Math computing question has this format: x op y =, where x and y are positive real numbers, op represents
math operator of +,-,*,/. The user ends the repeated input procedure by typing 0/0=. If the user types
in an invalid math question, the client should show an error message Input error. Re-type the math question
again.
The server should output the math questions sent by the client, and show the end of client input when receiving
0/0=, and then shut down. An example interaction between the client and the server is shown below (red
colored text are user input parts):
Client Side:
Server Side:
Connected with server on [IP address]
20+10.5=
Answer from server: 30.5
13/4=
Answer from server: 3.25
0/0=
User input ends; end the client program
Connected by client on [IP address]
Received question 20+10.5=; send back answer 30.5
Received question 13/4=; send back answer 3.25
Received question 0/0=; end the server program
When you submit this assignment to me, please submit the following (put in a .zip file):
A brief report: write a brief description of your program codes, then copy the screen output images in
your report, showing your client running screen and server running screen (must be screen shot images,
not the text you directly copy and paste onto your report). Your client and server interaction must show
each of those four types of math operations at least once.
Submit client source code and server source code as attachments in the Blackbord submission page. I will
try to download and run your code by myself. Be sure to explain clearly in your report how to compile
and run your code!
CE 3761: Computer Network Systems
Homework 3(Spring 2024)
Assigned Mar. 16h; Due midnight Mar. 28th via Blackboard
Programming notes
Here are a few tips to help you with the assignment:
If you code using C language, use this command line to compile your C program to generate the
executable file:
gcc -o client client.c (or gcc -o server server.c)
The machine IP address will be localhost
You must chose a server port number great that 1024(to be safe, choose a server port number larger than
5000). If you choose a port that is using currently by another user's server program, you have to choose
another port.
Make sure you close every socket that you use in your program before your program ends. If you abort
your program, the socket may still hang around and the next time you try and bind a new socket to the
same port number you previously used (but never closed), you may get an error "Address already in
use". If this happens, you have to wait a minute or so to let the hanging socket time out, or use a different
port number.
Be aware that port ID's, when bound to sockets, are system-wide values and thus other students may be
using the port number you are trying to use.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learning MySQL Get A Handle On Your Data

Authors: Seyed M M Tahaghoghi

1st Edition

0596529465, 9780596529468

More Books

Students also viewed these Databases questions

Question

What are their resources?

Answered: 1 week ago

Question

What impediments deal with customers?

Answered: 1 week ago