Socket gets stuck when doing readLine()

后端 未结 4 2057
死守一世寂寞
死守一世寂寞 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:59

    readLine() won't return until it's read a carriage return or a line feed, which is what you normally get when you read from a terminal or a text file.

    I wouldn't be surprised if the POP server doesn't actually tack \r\n on the end of its messages. Try read() instead.

提交回复
热议问题