Getting message from client

A particular distributed application in Java requires data to be sent from the client to the server which contains information in the form of a string, an array of integers, and twodouble values. The application is using a TCP socket connection between the client and the server. In Java specific terms, what would youdo to get the data correctly from the client to the server.

Now I understand how you go about reading in data from the client. This sample code was pulled from a Java example:

while ((inputLine = in.readLine()) !=null){

outputLine = kkp.processInput(inputLine);

out.println(outputLine);

if outputLine.equals("Bye."))

break;

}

My question is, I'm getting the data there by simply a string, right, since it's reading the line? How would I go about getting the interger and 2 double values?

[1142 byte] By [tristanlee85a] at [2007-11-27 2:47:08]
# 1
Why dont you try Integer.parseInt(string) or Integer in = new Integer(string);in.intValue()check api for double
AnanSmritia at 2007-7-12 3:16:15 > top of Java-index,Java Essentials,Java Programming...
# 2
Since you are getting the data from another application running on some host it is better you retrieve data in the form of a string and then check if it is a integer or double.
qUesT_foR_knOwLeDgea at 2007-7-12 3:16:15 > top of Java-index,Java Essentials,Java Programming...
# 3

A particular distributed application in Java requires data to be sent from the client to the server which contains information in the form of a string, an array of integers, and two double values.

The application is using a TCP socket connection between the client and the server. I

n Java specific terms, what would you do to get the data correctly from the client to the server.

I just wasn't completely sure how to do what he's asking. This is an essay question for my exam that I'm stumped on.

tristanlee85a at 2007-7-12 3:16:15 > top of Java-index,Java Essentials,Java Programming...
# 4

There could be two ways

One send the serialized object to the server and on server side you can get the data which you sent from the client.

Send the string with delimiters so you will be aware what is after each delimiter. And then you can convert them to int and double using Integer.parseint(String) .......

jawadhashmia at 2007-7-12 3:16:15 > top of Java-index,Java Essentials,Java Programming...