Welcome to JavaRanch.
Please
UseCodeTags when posting code of any length. It's unnecessarily hard to read, and will deter many people from looking at it. I have added those for you, but please remember to do that from now on.
I haven't looked at the code in detail -there are so many streams and readers that it's hard to figure out what's being used for what- but I noticed a couple of things. First, never do something like "}catch(Exception e){}" in I/O code. How will you know that there are problems? At the least, print a message to the console.
Secondly, you will get extraneous characters through the "pw.println(str1); pw.println(str2); pw.println(str3); pw.println(str4);" statements. Those strings already have "\r\n" at the end, so if you use "println" -instead of "print"- there will be extra newlines and possible extra carriage returns.
Lastly, you may run into problems if client and server don't run on the same machine. That's because you're not specifically dealing with encoding in the "new String" and "String.getBytes" calls. Those will use the platform default encoding, which may differ on different machines.
[ October 09, 2008: Message edited by: Ulf Dittmer ]