最近写了个socket的简单程序,用Buffered的IO(BufferedReader和BufferedWriter)时出现了问题,我的客户端发出已经write出去了,但是服务器端还是等待着客户端的输入。源代码如下:
    
    public String read(){
        try{
            return reader.readLine();
        }catch(IOException e){
            e.printStackTrace();
            return null;
        }
    }
    public void write(String text){
        try{
            writer.write(text);
            writer.flush();
        }catch(IOException e){
            e.printStackTrace();
        }其中两个输入输出都是Buffered前缀的最后实在没办法改用DataInputStream了,不过感觉还是BufferedIO用着舒服,请问其中原因是什么?