Server-Client with this with these functions

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chharles
    New Member
    • Nov 2009
    • 1

    Server-Client with this with these functions

    Hi I need to make a client socket - server in c + + for Linux.

    The server must do three things:
    1 -) When the client sends a file server lowercase words you must return the file with words capitalized

    2 -) When the client sends a file server capitalized words you must return the file with words lowercase.

    3 -) Capitalize the first letter of each word in a file.

    4 -) Send me a number and return it in letters example 1 and return one to me.

    I have several codes of client - server in c + + for linux but not in that part of the code to the features or how we do. Appreciate your response.
  • spiralfire
    New Member
    • Nov 2009
    • 8

    #2
    I can't see your question there... people won't do the entire code for you, you have to start it and when you have a question/error will help you.

    You can start with the cctype (ctype.h) library, there are functions that will check/set your chars to lower/upper case. As for sockets, you have to google it or read a book.

    For your third exercise you can use strtok (tokenizer) and capitalize the first letter.
    For the fourth.. well.. I didn't get it, maybe you typed some random words in there.

    Comment

    • RRick
      Recognized Expert Contributor
      • Feb 2007
      • 463

      #3
      Break the job into its components

      This program or actually set of programs is not that hard to write, but its not trivial either. There are 2 or possibly 3 major parts to this problem.

      First, you need to write code for a client and a server using sockets as the communication. There are lots of examples of this. Try googling "client server socket c++".

      Once you can get the client and the server set up and talking to each other, you need to figure out a protocol that both of them understand. It sounds like your problem just has the client send data and the server will read the data, change it and send it back to the client. If this is true, you simply have the client send the data and read the results from the server. Also, if this is true, the #3 change is not compatible with change #2.

      Sometimes, the client will use a simple protocol, where it first sends a command and then the data. You have to figure out what you need here.

      Lastly, you need to do the work and Sprialfire gave you some ideas of how to do that. It sounds like you need to break the file into words and strtok can do that. In C++, you can use an istringstream to parse the words.

      Comment

      Working...