重现连接重置c#

时间:2015-02-12 19:08:29

标签: c# sockets ioexception

如何为测试目的重现以下异常:

    Exception: System.IO.IOException
    Message: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.

    Nested Exception

    Exception: System.Net.Sockets.SocketException Message: An existing connection was forcibly closed by the remote host
    Source: System
    at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
    at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)

间歇性地发生,我写了一些使用重试模式的代码,但是我希望能够测试我的修复工作。

0 个答案:

没有答案