Http Streaming in asp.net

Discussion in 'ASP .Net' started by Jeff, Oct 25, 2008.

  1. Jeff

    Jeff Guest

    Hello

    Suppose I set up an http handler to stream data from a very large file to a
    web client.
    Would it be possible to communicate with the handler whilst it's returning
    data in order to reposition the file position?
    I guess this is a little bit like video or audio controls in an http
    streaming control..

    So if I had something like

    int count = imgStream.Read(buffer, 0, buffersize);
    while (count > 0)
    {
    /* Reposition output-stream based on user request here */
    context.Response.OutputStream.Write(buffer, 0, count);
    count = imgStream.Read(buffer, 0, buffersize);
    }

    inside the ProcessRequest method of my http handler, then would it be
    possible to reposition the output stream inside the while loop. Maybe I
    could do this by means of a shared session variable which could be updated
    by a separate handler or something? Or is there a better approach within
    asp.net?

    I know there are probably existing technolgies that can solve this problem
    for me but I'd like to understand how to do this sort of thing at a low
    level within in asp.net.

    Thanks in advance for any help.

    Jeff
    Jeff, Oct 25, 2008
    #1
    1. Advertising

  2. Jeff

    bruce barker Guest

    not with asp.net, it not low level enough to change the http protocol
    used by iis. in general iis/asp.net buffer the input request, and passes
    it to asp.net after its read (note that Request.InputStream is buffered,
    while the output may or may not be). you can probably do this with an
    isapi filter in ii 6.0, or with iis 7.0 doing a module.

    your other alternative is to use two contentions from the client, a
    controller and a stream.

    note: asp.net is not designed for streaming, so if you will have to bump
    up connection limits and pool sizes to support very many.


    -- bruce (sqlwork.com)


    Jeff wrote:
    > Hello
    >
    > Suppose I set up an http handler to stream data from a very large file to a
    > web client.
    > Would it be possible to communicate with the handler whilst it's returning
    > data in order to reposition the file position?
    > I guess this is a little bit like video or audio controls in an http
    > streaming control..
    >
    > So if I had something like
    >
    > int count = imgStream.Read(buffer, 0, buffersize);
    > while (count > 0)
    > {
    > /* Reposition output-stream based on user request here */
    > context.Response.OutputStream.Write(buffer, 0, count);
    > count = imgStream.Read(buffer, 0, buffersize);
    > }
    >
    > inside the ProcessRequest method of my http handler, then would it be
    > possible to reposition the output stream inside the while loop. Maybe I
    > could do this by means of a shared session variable which could be updated
    > by a separate handler or something? Or is there a better approach within
    > asp.net?
    >
    > I know there are probably existing technolgies that can solve this problem
    > for me but I'd like to understand how to do this sort of thing at a low
    > level within in asp.net.
    >
    > Thanks in advance for any help.
    >
    > Jeff
    >
    >
    bruce barker, Oct 25, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. batista
    Replies:
    3
    Views:
    4,538
    matrixfan33
    Sep 4, 2009
  2. Robert M. Gary

    Streaming over http

    Robert M. Gary, Jan 13, 2006, in forum: Java
    Replies:
    6
    Views:
    8,749
    Haider Albassam
    Jan 17, 2006
  3. MyHaz
    Replies:
    1
    Views:
    379
  4. Replies:
    1
    Views:
    519
  5. William Spitzer

    Streaming media with net/http

    William Spitzer, Sep 22, 2008, in forum: Ruby
    Replies:
    2
    Views:
    118
    FrihD
    Sep 22, 2008
Loading...

Share This Page