It appears that this HttpException (0x80072746 - The remote host closed the connection) can be thrown if, for example, the user closes the window whilst we are transmitting a file. Even if we send the files in smaller blocks and check the client is still connected, the exception can still occur. We want to be able to catch this specific exception, to ignore it.
The ErrorCode provided in the HttpException is an Int32 - too small to hold 0x80072746, so where do we find this number?
Int32 is not really too small to hold 0x80072746; only in “normal” notation, this number is negative: 0x80072746 == -2147014842, you can create a constant to compare the error code against:
or