[maemo-developers] [maemo-developers] HttpWebRequest in C#/Mono on N770 : The request timed out

From: Devesh Kothari devesh.kothari at nokia.com
Date: Fri Jan 20 12:24:36 EET 2006
ext marc.pub wrote:

> Hello,
>
> I try to access Internet in a C# / mono program with the
> HttpWebRequest class on my Nokia 770. See my program WebFetch below.
>
> When I execute the program it wait one minute at the
> HttpWebRequest.GetResponse(); method and exit with a time out. See my
> log below.
>
> With the use of TcpDump I found that there is no exchange of data.
>
> The program is not asking to initiate a new wifi connection
>
> The behaviour is the same if the connection is active or not.
>
> I can access the same url with the opera navigator in the same time.
>
> I use the mono environment that I found at
> http://www.mono-project.com/Mono:ARM. I believe it is the 1.1.9 mono
> release.
>
> I compiled the program (.exe) on Linux Ubuntu I386 with the 1.1.9 mono
> Release.
>
> Is someone succeeding with httpConnection and mono for the N770?
>
> Maybe I should 'activate' the connection specifically for mono before
> using HttpWebRequest class? But how to do?
>
Use the LD_PRELOAD

export LD_PRELOAD=/usr/lib/libosso-ic-preload.so;

in shell script, before launching your app.
I dont know how that would work out in mono scenario, I am assuming that mono runtime or whatever would finally 
try to make socket calls 


give it a shot
cheers
Devesh

> Any idea?
>
> Regards,
>
> Marc Bordessoule.
>
> ---- Exec log --------
>
> ~/mono/mono-nokia $ ./mono WebFetch.exe
>
> WebRequest.Create...
>
> Execute the request...
>
> Unhandled Exception: System.Net.WebException: The request timed out
>
> in <0x001b4> System.Net.HttpWebRequest:EndGetResponse (IAsyncResult
> asyncResult)
>
> in <0x0007b> System.Net.HttpWebRequest:GetResponse ()
>
> in <0x0017f> WebFetch:Main (System.String[] args)
>
> ~/mono/mono-nokia $
>
> ------ WebFetch.cs --------------------
>
>>
> class WebFetch
>
> {
>
> static void Main(string[] args)
>
> {
>
> StringBuilder sb = new StringBuilder();
>
> byte[] buf = new byte[8192];
>
> Console.WriteLine ("\nWebRequest.Create...");
>
> HttpWebRequest request = (HttpWebRequest)
> WebRequest.Create("http://www.monbureau.com");
>
> Console.WriteLine ("\nExecute the request...");
>
> HttpWebResponse response = (HttpWebResponse) request.GetResponse();
>
> Console.WriteLine ("\nRead data...");
>
> Stream resStream = response.GetResponseStream();
>
> string tempString = null;
>
> int count = 0;
>
> do
>
> {
>
> count = resStream.Read(buf, 0, buf.Length);
>
> if (count != 0)
>
> {
>
> tempString = Encoding.ASCII.GetString(buf, 0, count);
>
> sb.Append(tempString);
>
> }
>
> }
>
> while (count > 0);
>
> Console.WriteLine(sb.ToString());
>
> Console.WriteLine ("\nEnd.");
>
> }
>
> }
>
>------------------------------------------------------------------------
>
>_______________________________________________
>maemo-developers mailing list
>maemo-developers at maemo.org
>https://maemo.org/mailman/listinfo/maemo-developers
>  
>


More information about the maemo-developers mailing list