[Mono-list] HttpWebRequest differently compared to HttpWebRequest on .Net.
marten.ekblad at relevo.se
marten.ekblad at relevo.se
Tue Mar 13 16:21:39 UTC 2012
I run on 2-10-8. What version do I need?
/mårten
Skickat från min iPad
13 mar 2012 kl. 17:09 skrev "GonzaloP [via Mono]" <ml-node+s1490590n4469464h78 at n4.nabble.com<mailto:ml-node+s1490590n4469464h78 at n4.nabble.com>>:
On Fri, Mar 9, 2012 at 4:37 AM, [hidden email]</user/SendEmail.jtp?type=node&node=4469464&i=0>
<[hidden email]</user/SendEmail.jtp?type=node&node=4469464&i=1>> wrote:
> I have created a client app that communicates with a web service that uses
> the Comet way of sending events to a client. To do that I start a
> “long-living” HttpWebRequest to the server. The server communicates back to
> the client by sending chunked content (Transfer-Encoding: chunked).
> Individual events are then transferred in chunks. The problem for me here is
> that Mono seems to wait for the connection to terminate or the timeout to
> happen before sending the chunks back to the consumer of HttpWebRequest.
> This is not the case in .Net. In .Net each chunk is reported back
> individually when they arrive.
> This is the pseudo code I’m using:
> 1. HttpWebRequest req = WebRequest.Create( URL…);
> 2. req.BeginGetRequestStream(…);
> 3. stream = eventContext.WebRequest.EndGetRequestStream(…);
> 4. StreamWriter writer = new StreamWriter(stream);
> 5. writer.Write(data);
> 6. writer.Close();
> 7. eventContext.RequestStream.Close();
> 8. eventContext.WebRequest.BeginGetResponse(…);
> 9. HttpWebResponse resp = (HttpWebResponse)
> req.EndGetResponse(asynchronousResult);
> 10. responseStream = resp.GetResponseStream();
> 11. responseStream.BeginRead(eventContext.Buffer, 0, 20000, new
> AsyncCallback(DataReceived), eventContext);
> 12. In DataReceived I do responseStream.EndRead(asynchronousResult);
> 13. After that I arm the read again with responseStream.BeginRead(…);
>
>
> In .Net DataReceived is called on each packet. In Mono it’s called after 30
> seconds (probably the timeout).
>
> Is this the intended behavior with HttpWebRequest and chunked content? Is
> there another recommended way of dealing Comet style web services?
For the record, this was a bug that is now fixed in the mono-2-10 and
master branches.
-Gonzalo
_______________________________________________
Mono-list maillist - [hidden email]</user/SendEmail.jtp?type=node&node=4469464&i=2>
http://lists.ximian.com/mailman/listinfo/mono-list
________________________________
If you reply to this email, your message will be added to the discussion below:
http://mono.1490590.n4.nabble.com/HttpWebRequest-differently-compared-to-HttpWebRequest-on-Net-tp4458958p4469464.html
To unsubscribe from HttpWebRequest differently compared to HttpWebRequest on .Net., click here<http://mono.1490590.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4458958&code=bWFydGVuLmVrYmxhZEByZWxldm8uc2V8NDQ1ODk1OHwtMTE4MjM3MDE3Nw==>.
NAML<http://mono.1490590.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
--
View this message in context: http://mono.1490590.n4.nabble.com/HttpWebRequest-differently-compared-to-HttpWebRequest-on-Net-tp4458958p4469498.html
Sent from the Mono - General mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-list/attachments/20120313/3a187097/attachment-0001.html>
More information about the Mono-list
mailing list