Java client server not connecting to the Math server

I have created this simple java client server that prompts the user for a number and connects to the server. The server sends back the square root of the number.

All of my code is working and compiling without any errors, but seems like the client is not connecting to the server properly. I checked my logic couple of times and it looks good.

Right now the program doesn't do anything after printing this line in NumberClient.java:

System.out.print("Sending: " + command);

I am also attaching my files.

Any help?
ClientServerDemo.java
NumberClient.java
SquareRootServer.java
SquareRootService.java
vertigo_Asked:
Who is Participating?
 
saravanakgCommented:
Hi change the line "String command = "NUMBER "+number ; in NumberClient to
String command = "NUMBER "+number +"\n";.

So that you are ending the line in stream.

After that it is working fine as you  expected.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.