Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You need to write 2 separate C programs, a client & server. The client makes a connection to the server and transmits a series of

You need to write 2 separate C programs, a client & server. The client makes a connection to the server and transmits a series of numbers. The server listens for client communication and when it has received the series of numbers, it adds them together and closes.

Program requirements:

1. The client needs to know the server IP address and port number. Determine these from the server and make sure if you run the server, followed by the client that they can communicate. If you run both on the same server, any port above 1024 is valid.

2. Client code: prompt the user for how many numbers to add together, then prompt them for each number. Conversion from string to integer must be done on the client.

3. Server code: Display each integer immediately after it is entered on the client. When the client is nished sending numbers, the server code should add the numbers together, display the total, and then shutdown. (Hint: If you establish a new connection on the server for every number transmitted, the server may need a pipe to communicate numbers from the child processes to the parent process. If you transmit all of the numbers in a single connection, you probably will not need to do this.)

4. Close all sockets on the server and client when nished. Make sure all child processes are closed.

$ ./client localhost 7500

How many numbers should I add together? 2

Enter a number: 99

Enter a number: 45

$ ./server 7500

Received number 1: 99

Received number 2: 45

Here are the numbers added together: 144

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

Step: 3

blur-text-image

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

Database Systems Introduction To Databases And Data Warehouses

Authors: Nenad Jukic, Susan Vrbsky, Svetlozar Nestorov

1st Edition

1943153191, 978-1943153190

More Books

Students also viewed these Databases questions