The remote host closed the connection. The error code is 0x800704CD. Firefox creates issue

1
using (Stream stream = _client.GetDownloadStream(filePath))
                    {
                        long toRead = length;

                        stream.Seek(startIndex, SeekOrigin.Begin);

                        using (Stream outStream = context.Response.OutputStream)
                        {
                            // The reported bytes are off, we have to manually keep count
                            // of read bytes
                            while (toRead > 0 && stream.Read(buffer, 0, chunk) > 0)
                            {
                                long readSize = toRead < chunk ? toRead : chunk;
                                outStream.Write(buffer, 0, (int)readSize);
                                outStream.Flush();

                                toRead -= chunk;
                            }
                        }
                    }
                    context.Response.End();
                }
                else
                {
                    ErrorProcessing(context);
                }

            }
            catch (ThreadAbortException ex)
            {
                Utils.Log.Info("Aborted thread - User aborted download", ex);
            }
            >>>>>>>catch (Exception inex)
            {
                if (context.Response.IsClientConnected)
                {
                    Utils.Log.CustomError("Failed to stream recording " +
                                    inex.Message + " " + inex.StackTrace);
                }
            }

What I'm actually trying to do
- Open SFTP connection to my server file storage.
- Begin a Stream.
- Read Bits and try writing to stream back.

What is my Problem?
- The above code perfectly streams audio in Google Chrome, Microsoft Edge and Internet Explorer but fails to do this in Mozilla Firefox.

My Investigation
- Firefox somehow cleans up the session variables and maybe that's why the connection is close, but I might as well discard this because it allows me to download the same file, but does not stream.
- I've also read: The remote host closed the connection. The error code is 0x800704CD but could not find a solution or at least how to avoid the error.

Background
- Developing a C# - .NET application, and need to stream audio from our storage. - I've marked the error by >>>>> in the code. That's where I catch the exception.

Really looking forward to guidance on how to go around this problem.

c#
.net
firefox
audio
audio-streaming
asked on Stack Overflow Nov 7, 2016 by Viv • edited May 23, 2017 by Community

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0