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

2006-05-02 Thread Carlos Solorzano
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


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)

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


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

2006-05-02 Thread Sunny

On 5/2/06, Carlos Solorzano [EMAIL PROTECTED] 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

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)



You can/will have problems with this approach under Windows as well.
You do not close the stream, thus not closing the connection. By
default you have only 2 web connections per host, and the next
connections are queued. There may be a bug/problem with the mono
implementation, which does not autoclose the connections in the
timeout period though.

--
--
Svetoslav Milenov (Sunny)

Windows is a 32-bit extension to a 16-bit graphical shell for an 8-bit
operating system originally coded for a 4-bit microprocessor by a
2-bit company that can't stand 1 bit of competition.
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


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

2006-05-02 Thread Gonzalo Paniagua Javier
On Tue, 2006-05-02 at 16:24 -0500, Carlos Solorzano wrote:
 try
 {
 
 System.Net.WebRequest.Create(http://google.com;).GetResponse().GetResponseStream().ReadByte();
 Console.WriteLine(new conn  + (i++)  );
 }
 catch(Exception ex)

You better Close() the response stream or the response when you're done
with it.

-Gonzalo


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list