Q:

what's wrong with the OutputStreamWriter used to write in socket for server?

I am trying to learn socket programming.I wrote client using InputStreamReader and with BufferedReader i read the msg sent from server.
For server if i write PrintWriter with print method it works and with write method it's not,why?
And OutputStreamReader is not at all useful as it does not have print method and with write, i am not getting messages in client side.
Thanks in Advance
EDIT:Client:
Socket c=new Socket("143.22.165.27",6000);
        InputStreamReader isr=new InputStreamReader(c.getInputStream());
        BufferedReader br=new BufferedReader(isr);
        String s=br.readLine();
        System.out.println(s);

Srver
Socket sock=s.accept();
             OutputStreamWriter out =
                     new OutputStreamWriter(sock.getOutputStream());
                 out.write("...........");

A:

I assume you are using the readLine() method on the client's BufferedReader. So my guess would be that you aren't writing any newline characters when you use the write() methods on the server. Thus, the client never reaches the end of a line. A PrintStream or a PrintWriter adds the newline characters for you whenever you call a println() method.
Of course, without any code or even a description of the problem, it's hard to say for sure.

