I need to write a simple servlet which will be the client, and it should be sending some simple strings to server written in java. However I have a problem and I don't know how to solve it. I was trying to put the code in servlet methods but it ain't working. Here is the code which works great in my standard (non servlet) java client: http://pastebin.com/m6503d49f
Can anybody help me, how to solve the problem. By the way this is for my school project.