BufferedWriter and socket in java, write has no effect

后端 未结 3 2077
余生分开走
余生分开走 2021-01-07 05:28

I\'m writing a small client application to communicate with a server. I open a socket between my client and the server and can read anything that goes out from the server wi

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-07 05:30

    At this point, there is no convincing evidence that your client code is not working. In particular, this statement:

    System.out.println(socketWritter.toString());
    

    won't tell you anything useful. The toString() method only on a Stream object most likely only tells you the object's class name and its identity hashcode. It certainly won't tell you what you've written to the stream.

    Given that, there is no clear evidence that the flush hasn't worked. (The problem could be on the server side.)

提交回复
热议问题