Ok. sorry for the messy explanation. To save time, I just paste the problems here so you could have a clear idea.
This is actually a practice given by my mentor, but since posting homework is against the rules, so it's not actually the whole question i am pasting here.
The goal is to implement a TCP client and server and exchange data.
I just wish to run in a same pc instead of bring connection over another pc.
The server will start in passive mode listening on a specified port for a transmission from a client. Separately, the client will be started and will contact the server on a given IP address and port number that must be entered via the command line. The client will pass the server a string consisting of a sequence of characters. If the string contains anything but numbers, the server will respond with "Sorry, cannot compute!" and exit. If the string contains all numbers, the individual digits will be added together and returned as a string (see below for an example). If the server sends a "Sorry" response to the client it will immediately exit. If the server receives a string of numbers, it will (1) add the digits together, (2) send the value back to the client, and (3) will not exit unless the response is a single digit. This process will be repeated until there is only one digit remaining.
So the output mostly like this:
Client Input/Output for Non-Numeric Example
T202-machine2> client 192.168.80.4 8800
Enter string: I don't like addition!!
From server: Sorry, cannot compute!
T202-machine2>
Client Input/Output for Numeric Example
T202-machine2> client 192.168.80.4 8800
Enter string: 123456789101234567891012345678910
From server: 138
From server: 12
From server: 3
T202-machine2>
I hope i did not twist the problems i was asking at the first place. Actually i have given 2 files which is the client and server file, that i already have shown you above,and I was request to modify these files and meet the requirements mentioned above.
|