<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>A Real-Time Trace Listener/Watcher</title><link>http://blogs.msdn.com/dditweb/archive/2007/09/06/a-real-time-trace-listener-watcher.aspx</link><description>Goals of this post: Example for writing a custom trace listener which outputs real-time information over the network, which can then be consumed by a remote client. Example for writing that remote client, which functions much like FileMon in showing real-time</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>MSDN Blog Postings  &amp;raquo; A Real-Time Trace Listener/Watcher</title><link>http://blogs.msdn.com/dditweb/archive/2007/09/06/a-real-time-trace-listener-watcher.aspx#4802487</link><pubDate>Fri, 07 Sep 2007 09:31:49 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4802487</guid><dc:creator>MSDN Blog Postings  » A Real-Time Trace Listener/Watcher</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://msdnrss.thecoderblogs.com/2007/09/07/a-real-time-trace-listenerwatcher-2/"&gt;http://msdnrss.thecoderblogs.com/2007/09/07/a-real-time-trace-listenerwatcher-2/&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>re: A Real-Time Trace Listener/Watcher</title><link>http://blogs.msdn.com/dditweb/archive/2007/09/06/a-real-time-trace-listener-watcher.aspx#9862522</link><pubDate>Sun, 09 Aug 2009 19:11:18 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9862522</guid><dc:creator>Don</dc:creator><description>&lt;p&gt;Nice light tool. I have problem such client freezes on disonnect. (Never released while waitng for the child thread in the join)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;/// &amp;lt;summary&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;/// Attempt to disconnect everything and clean up. This leaves us in a&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;/// state where we're ready to initiate another connection.&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;/// &amp;lt;/summary&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;private void Disconnect()&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (m_ReaderThread != null)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;m_StopReading = true;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;WriteStatus(&amp;quot;Waiting for reader to finish...&amp;quot;);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;m_ReaderThread.Join(); &amp;nbsp;// Wait for the child thread.&lt;/p&gt;
&lt;p&gt;...&lt;/p&gt;
</description></item><item><title>re: A Real-Time Trace Listener/Watcher</title><link>http://blogs.msdn.com/dditweb/archive/2007/09/06/a-real-time-trace-listener-watcher.aspx#9862530</link><pubDate>Sun, 09 Aug 2009 19:19:26 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9862530</guid><dc:creator>Don</dc:creator><description>&lt;p&gt;Fixed by addinf if (_StopReading) break; in the sleep loop&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// In case we're started before things are ready...&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;while (_NetworkStream == null || ! _NetworkStream.DataAvailable)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Thread.Sleep(1000);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (_StopReading)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;break;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
</description></item></channel></rss>