I am trying to connect to a POP server through Sockets in Java. I executed the following code to run the LIST command to display all emails from the server. But I do not know why, on the second readLine (), to read the second line and on, my application hangs there.
popSock = new Socket(mailHost, pop_PORT); inn = popSock.getInputStream(); outt = popSock.getOutputStream(); in = new BufferedReader(new InputStreamReader(inn)); out = new PrintWriter(new OutputStreamWriter(outt), true);
On the second in.readLine() application is stuck here and does not come from here. When I run the LIST command on telnet, I get the entire list of letters. So I have to get the same answer from the socket, but I donβt know. How should I read the entire answer line by line from the server?
source share