http://bugzilla.novell.com/show_bug.cgi?id=591291
http://bugzilla.novell.com/show_bug.cgi?id=591291#c2 Mark Apperson <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEEDINFO |NEW InfoProvider|[email protected] | --- Comment #2 from Mark Apperson <[email protected]> 2010-03-28 00:33:24 UTC --- OK, try this piece of code. The Sleep is necessary to give the first bits of data a chance to move through the streams/socket before the XmlReader is initialized. using System; using System.Net.Sockets; using System.Text; using System.Threading; using System.Xml; namespace XmlReaderDeadlock { class MainClass { static Byte[] rootBytes = Encoding.ASCII.GetBytes("<ROOT>"); static Byte[] tagBytes = Encoding.ASCII.GetBytes("<TAG>value</TAG>"); static NetworkStream serverStream; static void Main(string[] args) { Int32 ctr = 0; new Thread(ServerImpl).Start(); TcpClient client = new TcpClient(); client.Connect("localhost", 8080); Thread.Sleep(100); XmlReader reader = XmlReader.Create(client.GetStream()); while (reader.Read()) { switch (reader.Name) { case "TAG": ++ctr; //Int64 position = serverStream.Position; Console.WriteLine("Read Tag"); serverStream.Write(tagBytes, 0, tagBytes.Length); //serverStream.Position = position; break; default: break; } if (ctr >= 10) break; } Console.WriteLine("Done"); } public static void ServerImpl() { TcpListener listener = new TcpListener(System.Net.IPAddress.Any, 8080); listener.Start(); Socket svrSocket = listener.AcceptSocket(); serverStream = new NetworkStream(svrSocket); serverStream.Write(rootBytes, 0, rootBytes.Length); serverStream.Write(tagBytes, 0, tagBytes.Length); } } } -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
