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

From: marc.pub marc.pub at monbureau.com
Date: Thu Jan 19 20:37:05 EET 2006
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?

 

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.");

            }

}

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maemo.org/pipermail/maemo-developers/attachments/20060119/0a6c0508/attachment.htm 
More information about the maemo-developers mailing list