multipart message from WebRequest (asynchronous)

Discussion in 'ASP .Net' started by =?Utf-8?B?S1JlaWNoZXJ0?=, Feb 24, 2006.

  1. How do you retrieve the streaming 'parts' of a multipart message from a
    WebRequest?

    Here is the situation.

    A WebRequest is submitted to a server (http://TheServer:80/GetMedia?ID=1).
    This causes the server to push/stream a multipart message back to the client
    in the following format:

    HTTP/1.1 200 OK
    Date: Fri, 24 Feb 2006 12:01:31 CST
    Server: MyServer/1.0
    Content-type: multipart/x-mixed-replace;boundary=Separator

    --Separator
    Content-Type: image/jpeg
    Content-Transfer-Encoding: binary
    Content-Length: 11346

    <binary data>

    --Separator
    Content-Type: image/jpeg
    Content-Transfer-Encoding: binary
    Content-Length: 11346

    <binary data>

    --Separator--

    In the callback for BeginGetResponse, the get response I get the response
    from the EndGetReponse method. The response stream contains the first 'part'
    (everything between the first and second '--Separator', ie both the headers
    and binary data). How do I get the rest of the message parts?
    =?Utf-8?B?S1JlaWNoZXJ0?=, Feb 24, 2006
    #1
    1. Advertising

  2. =?Utf-8?B?S1JlaWNoZXJ0?=

    Joerg Jooss Guest

    Thus wrote KReichert,

    > How do you retrieve the streaming 'parts' of a multipart message from
    > a WebRequest?
    >
    > Here is the situation.
    >
    > A WebRequest is submitted to a server
    > (http://TheServer:80/GetMedia?ID=1). This causes the server to
    > push/stream a multipart message back to the client in the following
    > format:
    >
    > HTTP/1.1 200 OK
    > Date: Fri, 24 Feb 2006 12:01:31 CST
    > Server: MyServer/1.0
    > Content-type: multipart/x-mixed-replace;boundary=Separator
    > --Separator
    > Content-Type: image/jpeg
    > Content-Transfer-Encoding: binary
    > Content-Length: 11346
    > <binary data>
    >
    > --Separator
    > Content-Type: image/jpeg
    > Content-Transfer-Encoding: binary
    > Content-Length: 11346
    > <binary data>
    >
    > --Separator--
    >
    > In the callback for BeginGetResponse, the get response I get the
    > response from the EndGetReponse method. The response stream contains
    > the first 'part' (everything between the first and second
    > '--Separator', ie both the headers and binary data). How do I get the
    > rest of the message parts?


    The response stream is just that -- a stream of bytes. It has no notion of
    parts. You have to make sure that you read all bytes from the response stream
    before continuing higher level processing such as parsing parts.

    Cheers,
    --
    Joerg Jooss
    Joerg Jooss, Feb 25, 2006
    #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. Guoqi Zheng

    mime multipart message

    Guoqi Zheng, May 22, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    466
    Guoqi Zheng
    May 22, 2004
  2. DotNetShadow
    Replies:
    0
    Views:
    1,535
    DotNetShadow
    Feb 7, 2005
  3. =?Utf-8?B?RGVtaQ==?=

    Asynchronous WebRequest Timeout bug

    =?Utf-8?B?RGVtaQ==?=, Mar 30, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    3,024
    =?Utf-8?B?RGVtaQ==?=
    Mar 30, 2006
  4. APA
    Replies:
    0
    Views:
    516
  5. Replies:
    1
    Views:
    389
Loading...

Share This Page