I'm using a Customizable-Embedded-HTTPServer for a project. Simply I'm calling response.SendFile(@"E:\folder\xx.mp4", "video/mp4") to play video files located at local folder. But it gives me "An existing connection was forcibly closed by the remote host" error. I've searched a lot but couldn't find a solution!

using (FileStream fs = File.OpenRead(path))     
{
                    this.Date = File.GetLastWriteTime(path);
                    this.ContentLength = fs.Length;
                    this.ContentType = mediaType;
                    this.ChunkedTransferEncoding = false;
                    _stream = new HTTPOutputStream(_session);
                    Write(_stream);
                    int rc;
                    byte[] bytes = new byte[65536];
                    do
                    {
                        rc = fs.Read(bytes, 0, 65536);
                        _stream.Write(bytes, 0, rc); //**here the error is thrown!!**
                    } while (rc != 0);
                }

Any suggestion is appreciated.

Related posts

Recent Viewed