Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > multipart message from WebRequest (asynchronous)

Reply
Thread Tools

multipart message from WebRequest (asynchronous)

 
 
=?Utf-8?B?S1JlaWNoZXJ0?=
Guest
Posts: n/a
 
      02-24-2006
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?
 
Reply With Quote
 
 
 
 
Joerg Jooss
Guest
Posts: n/a
 
      02-25-2006
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
news-


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to read header of a multipart message using javaMail GunjanM Software 0 03-20-2008 08:37 PM
winhttprequest posting byte() and string in multipart message. Howto fnoppie@gmail.com ASP General 6 06-11-2007 08:38 PM
Please Help:[JavaMail]How to make the embeded images display properly when to show a Multipart/related message? M.Liang Liu Java 2 05-28-2007 10:08 AM
MIME Structure Multipart/Mixed with attachment and Multipart/Alternative blaine@worldweb.com Perl Misc 1 04-04-2007 08:23 PM
mime multipart message Guoqi Zheng ASP .Net 0 05-22-2004 08:29 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57