I get something similar when there is a proxy involved.

Are you using Onavo on your phone? or any other proxy?



On Mon, Sep 10, 2012 at 10:57 AM, sday <[email protected]> wrote:
> Using typical HttpWebRequest code I noticed some odd behavior. Under Wifi it
> works fine, but when trying to read a server php POST I get erratic results
> under a cellular connection.
>
> =======================================
> HttpWebRequest request = (HttpWebRequest)WebRequest.Create (url);
> request.Method = "POST";
> request.ContentType = "application/json";
>
> request.ContentLength = dataStream.Length;
> request.CookieContainer = http.cookies;
>
> Stream newStream = request.GetRequestStream ();
> newStream.Write (dataStream, 0, dataStream.Length);
> newStream.Close ();
>
> HttpWebResponse response = (HttpWebResponse)request.GetResponse ();
>
> StreamReader sr = new StreamReader(response.GetResponseStream());
>
> string r = sr.ReadToEnd().Trim();
> Console.WriteLine("READ=["+r+"]");
> ============================================
>
> I've tried several variations, but nothing seems to make a difference. When
> reading from my server script on a cellular connection, I mostly get back
> zero bytes. Sometimes I do get back the response expected. Under wifi it
> always works. I have this type of code working with other frameworks hitting
> the same scripts, but I cannot figure out what it is.
>
> Any thoughts?
>
> Thanks -Steve
>
>
>
> --
> View this message in context: 
> http://monotouch.2284126.n4.nabble.com/HttpWebRequest-Issue-with-MonoTouch-only-under-cellular-transport-tp4656941.html
> Sent from the MonoTouch mailing list archive at Nabble.com.
> _______________________________________________
> MonoTouch mailing list
> [email protected]
> http://lists.ximian.com/mailman/listinfo/monotouch



-- 
Nic Wise
t.  +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise
b. http://www.fastchicken.co.nz/

mobileAgent (for FreeAgent): get your accounts in your pocket.
http://goo.gl/IuBU
Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa
Earnest: Self-employed? Track your business expenses and income.
http://earnestapp.com
Nearest Bus: find when the next bus is coming to your stop. http://goo.gl/Vcz1p
London Bike App: Find the nearest Boris Bike, and get riding! http://goo.gl/Icp2
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to