[Mono-bugs] [Bug 74161][Nor] Changed - XmlTextReader.Read blocked when reading Xml from Network Stream

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Tue, 5 Apr 2005 19:25:42 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by anarchyco@hotmail.com.

http://bugzilla.ximian.com/show_bug.cgi?id=74161

--- shadow/74161	2005-03-29 01:53:39.000000000 -0500
+++ shadow/74161.tmp.6152	2005-04-05 19:25:42.000000000 -0400
@@ -10,13 +10,12 @@
 Component: Sys.XML
 AssignedTo: mono-bugs@ximian.com                            
 ReportedBy: anarchyco@hotmail.com               
 QAContact: mono-bugs@ximian.com
 TargetMilestone: ---
 URL: 
-Cc: 
 Summary: XmlTextReader.Read blocked when reading Xml from Network Stream
 
 Please fill in this template when reporting a bug, unless you know what you
 are doing.
 Description of Problem:
 
@@ -125,6 +124,47 @@
 }
 
 
 ------- Additional Comments From atsushi@ximian.com  2005-03-29 01:53 -------
 Also, posting patch in svn diff style is much better.
 
+
+------- Additional Comments From anarchyco@hotmail.com  2005-04-05 19:25 -------
+Complete code that doesn't block in MS.NET and is blocked in Mono.
+
+I'll try to post the patch in svn diff style, but I'm not sure I'll
+achieve it.
+
+Thx a lot.
+
+using System;
+using System.Xml;
+using System.Text;
+using System.Net.Sockets;
+
+	class Class1
+	{
+		static void Main(string[] args)
+		{
+			TcpClient client = new TcpClient("jabber.org",5222);
+
+			byte [] data = Encoding.UTF8.GetBytes("<stream:stream
+to='jabber.org' xmlns='jabber:client'
+xmlns:stream='http://etherx.jabber.org/streams'>");
+
+			Console.WriteLine ("byte length: " + data.Length);
+
+			client.GetStream().Write (data, 0, data.Length);
+
+			client.GetStream().Flush ();
+
+			Console.WriteLine ("to make sure that block did not happen above.");
+
+			XmlTextReader reader = new XmlTextReader (client.GetStream());
+
+			Console.WriteLine ("again, to make sure that block did not happen
+above.");
+
+			while (reader.Read()) // Never returns both under MS.NET and Mono
+				Console.WriteLine ("Read node");
+		}
+	}