This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
I am just trying to create a simple echo server. For some reason I can't determine I will connect to the server using the client program and the server will acknowledge that it received a connection, but the server never echoes what the client sends to them.
Any help would be great.
"If the facts don't fit the theory, get new facts" --Albert Einstein
Well, for one thing you're using PrintWriters to send data over the network. This is a problematic practice because PrintWriter is specifically written not to throw exceptions, and you do want to know about exceptions in an environment which is likely to have them.
The other thing is that you aren't echoing the data sent exactly. You are removing line-ending characters from it. This could be a problem when your client is expecting to receive data terminated by line-ending characters.
I didn't know that about PrintWriter. I was formatting my example off of code I saw on the Oracle tutorial page and PrintWriter was used there, next time I'll investigate more. Would PrintStream be a better option to send data across the network?