Socket gets stuck when doing readLine()

后端 未结 4 2055
死守一世寂寞
死守一世寂寞 2020-12-07 05:10

I am trying to connect to the POP server through Sockets in Java. I did the following code to run a LIST command to list all the emails from the server. But I don\'t know wh

4条回答
  •  攒了一身酷
    2020-12-07 05:46

    You can try following--

        try {
            String line = inn.readLine();
            while(***input.ready()***)
            {
                System.out.println(line);
                line=inn.readLine();
    
            }
            inn.close();
    
    
        } catch (IOException e) {
    
            e.printStackTrace();
        }
    

    where inn is your bufferedReader object whih stores the inputstreamdata

提交回复
热议问题