> I have a problem.
Yet you didn't tell us what it is...
> I want to create a tcp/ip java application .
> The client is written in C, while my server is written in java. Now I
> have found this code to write my server.
[...]
> What do you think about it?
The first thing I think is that the comments are in a language that I
don't know.
The second is that whoever wrote the code doesn't know anything about
character encodings or internationalization. It uses two very dangerous
methods -- DataInputStream.readLine, and DataOutputStream.writeBytes --
that have far better alternatives.
> Now I want know how can I convert stream received from client
> (input????) into a byte[]. Have I to use String.getBytes() method?
No, don't use String.getBytes(). Converting bytes to characters and
then back to bytes again is unnecessary, and risks losing information
depending on your platform character encoding. In short, it is wrong.
How many bytes are you expecting? Is the protocol byte-counted, or is
there a termination byte to look for?

Signature
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation