Hi Ive made the following program I'm just looking for a little help on how to fix the following:
1)I'm stuck trying to figure out how to supply the listening port number as a command line argument when starting the program.
)For example I want it to ask for a port number when I start the program and use that specified port.
2)The second thing im trying to do is have the server report back a string that tells the client how many integers and non-integer words were in the previous message.
)For example I send the following message from my client to my server "Hi today is July 6"
I want my server to return a string "4 1"
Indicating that the incoming string has 4 non integer words and 1 integer.
1. Use the args array as specified on the main method.
If args.size() > 0 then you have a command line parameter.
Since this is a String, convert it to an integer (serverPortNumber) and pass it as:
2. Once you receive the packet from the client, tokenize it, using either split() or StringTokenizer using the space character as a delimiter. now iterate through the tokens, try to convert to an interger,
and catch the illegalNumberFormat exception. Those are strings, else integers. Maintain two counters,
and you're good to go.
Post your code here as you progress.
Joined: Jul 06, 2012
Sorry I'm totally new to this. I understand what your saying but I'm unfamiliar with the java syntax.
I get a few errors
Cannot invoke size() on the array type String
Syntax error, insert ") Statement" to complete IfStatement
Syntax error on token "if", ( expected after this token
Syntax error on token "myint", invalid Dimensions
This is what I have but I cant compile