[Mono-dev] Re: After two tried I get a System.Net.WebException: The request timed out

Robert Jordan robertj at gmx.net
Tue May 2 17:43:03 EDT 2006


Carlos Solorzano wrote:
> Can someone else confirm this with me, I have an infinite loop calling a 
> webpage (google is there just for you guys but I was calling a server 
> internal to my network). On windows it runs fine but on mono I get a 
> timeout after the second try. I have 1.1.10.1

You must close/dispose the response.

Have a look at http://bugzilla.ximian.com/show_bug.cgi?id=78078

Robert


> 
> using System;
> 
> namespace ConsoleApplication4
> {
>    /// <summary>
>    /// Summary description for Class1.
>    /// </summary>
>    class Class1
>    {
>        /// <summary>
>        /// The main entry point for the application.
>        /// </summary>
>        [STAThread]
>        static void Main(string[] args)
>        {
>            int i = 0;
>            while(true)
>            {
> 
>                try
>                {
>                    
> System.Net.WebRequest.Create("http://google.com").GetResponse().GetResponseStream().ReadByte(); 
> 
>                    Console.WriteLine("new conn " + (i++)  );
>                }
>                catch(Exception ex)
>                {
>                    Console.WriteLine("ERROR: " + ex);
>                }
>                System.Threading.Thread.Sleep(1000);
>            }
>        }
>    }
> }
> 
> #mono ConsoleApplication4.exe
> new conn 0
> new conn 1
> ERROR: System.Net.WebException: The request timed out
> in <0x00147> System.Net.HttpWebRequest:EndGetResponse (IAsyncResult 
> asyncResult)
> in <0x00047> System.Net.HttpWebRequest:GetResponse ()
> in <0x00033> ConsoleApplication4.Class1:Main (System.String[] args)




More information about the Mono-devel-list mailing list