LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-05-2011, 01:07 AM   #16
silentkill89
LQ Newbie
 
Registered: Aug 2011
Posts: 28

Original Poster
Rep: Reputation: Disabled

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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Extracting integers from a string teresevo1 Programming 3 11-08-2010 08:24 PM
trouble adding days to a passed in date string ne00 Programming 5 04-08-2009 04:35 PM
Adding new functions in string class linux_chris Linux - Software 2 02-22-2009 02:59 PM
Adding Unsigned Integers of 128 bit bluechicken Programming 1 06-27-2005 02:27 PM
adding to vector<string> in a struct niteshadw Programming 3 02-03-2005 07:08 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:02 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration