Socket problem - readline won't work properly

后端 未结 5 1269
灰色年华
灰色年华 2020-12-11 13:09

I try to code a client and server connection using socket. The problem is my client can\'t read the response from the server (it hangs on the readline).

Here is some

5条回答
  •  既然无缘
    2020-12-11 13:23

    Okay, I've figured this one out. It's not the client that hangs, it's the server. It tries to read a line of text from the client, but the client doesn't send the line separator:

        out.write("My message");
        out.flush();
    

    Replace write() with println() here.

提交回复
热议问题