Socket gets stuck when doing readLine()

后端 未结 4 2048
死守一世寂寞
死守一世寂寞 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 should be sending \r\n after each command, also, try not using a BufferedInputStream, try reading directly from the InputStream byte by byte to see at which point it actually hangs. The BufferedInputStream may be hanging waiting to read more before returning what it has already read.

提交回复
热议问题