Due Date: May 10, 2017 23:59 hours
You need to write 2 separate 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.
(Two
server programs are provided: make sure you start with server2.c, not server.c)
Program requirements:
- 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. If you run the server on C322.WIRSZ.COM and use a port number between 7000-8000, you can use the client on a different UNIX/Linux server or desktop. (no code
changes)
- Fix
the sample code so it runs on the K200 or C322 without errors or warnings.
- 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.
- Server
code: Display each integer immediately after it is entered on the client. When
the client is finished 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.)
- Close all sockets on the server and client when finished. Make sure all child processes are closed.
- 5% Extra Credit: instead of Canvas, submit your assignment via https://education.github.com/ (MUST be private, invite swirsz) I will use Github’s last modified date as the submission date. Put your full name in the header of your file.