ServerSocket java not reading inputStream?

后端 未结 3 1991
小蘑菇
小蘑菇 2021-01-27 13:06

I have written a server is java here is the code:

public mainClass() 
{ 
    try 
    { 
        ss = new ServerSocket(8080); 

        while (true) 
        { 
         


        
3条回答
  •  不思量自难忘°
    2021-01-27 13:59

    My guess is that the client application doesn't send any line break at the end of the string it sends. So BufferedReader.readLine() waits for an EOL character, and only returns the string when the client application ends, because at this point the connection is closed and the reader knows there won't ever be an EOL, and the string is the last line it will ever receive.

提交回复
热议问题