Random “An existing connection was forcibly closed by the remote host.” after a TCP reset

后端 未结 4 1752
你的背包
你的背包 2021-02-19 19:14

I have two parts, a client and a server. And I try to send data (size > 5840 Bytes) from the client to the server and then the server sends the data back. I loop this a number o

4条回答
  •  天涯浪人
    2021-02-19 19:31

    I am no expert but don't you think calling stream.Close() on Client will close stream while server is still trying to write at

    // Send back a response.
    stream.Write(bytes, 0, size);
    

    Also you may want to put some data to mark end of it, so that server knows and stops reading.

提交回复
热议问题