<?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>The Hogg Blog : C#</title><link>http://blogs.msdn.com/thehoggblog/archive/tags/C_2300_/default.aspx</link><description>Tags: C#</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Creating a Logo / Turtle Graphics Textual DSL using Oslo MGrammar</title><link>http://blogs.msdn.com/thehoggblog/archive/2008/11/25/a-logo-turtle-graphics-sample-in-mgrammar.aspx</link><pubDate>Wed, 26 Nov 2008 01:17:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9142858</guid><dc:creator>Jason Hogg</dc:creator><slash:comments>6</slash:comments><comments>http://blogs.msdn.com/thehoggblog/comments/9142858.aspx</comments><wfw:commentRss>http://blogs.msdn.com/thehoggblog/commentrss.aspx?PostID=9142858</wfw:commentRss><wfw:comment>http://blogs.msdn.com/thehoggblog/rsscomments.aspx?PostID=9142858</wfw:comment><description>&lt;P&gt;In the early 1980's a programming language called &lt;A class="" href="http://en.wikipedia.org/wiki/Turtle_graphics" mce_href="http://en.wikipedia.org/wiki/Turtle_graphics"&gt;Turtle Graphics&lt;/A&gt;&amp;nbsp;was used as a means of introducing novices to programming on the &lt;A class="" href="http://blogs.msdn.com/thehoggblog/archive/2008/03/22/glory-days-home-computing-in-the-80-s.aspx" mce_href="http://blogs.msdn.com/thehoggblog/archive/2008/03/22/glory-days-home-computing-in-the-80-s.aspx"&gt;BBC Microcomputer&lt;/A&gt;. Turtle graphics, a graphical version of Logo, helped introduce people to programming using a simple functional language that provided instant visual gratification allowing the user to move a triangular turtle across the screen using simple commands such as forward, backward, right turn and left turn.&lt;/P&gt;
&lt;P&gt;At PDC this year the Connected Systems team introduced a new language called "M" - which allows textual DSL's to be created. I will talk more about this language in future posts especially compared with the F# Lexer and Parser that we used to create our textual DSL for &lt;A class="" href="http://blogs.msdn.com/thehoggblog/archive/2007/08/26/parser-for-secpal-simplified-english-grammar-now-available.aspx" mce_href="http://blogs.msdn.com/thehoggblog/archive/2007/08/26/parser-for-secpal-simplified-english-grammar-now-available.aspx"&gt;SecPAL&lt;/A&gt;, but first I wanted to create a programming language with which to learn Mg. I thought a version of Turtle Graphics would be fun - and interesting for anyone else interested in experimenting with or learning Mg. &lt;/P&gt;
&lt;P&gt;The programming language I am liberally calling Logo (and the associated interpreter) are fairly simple - but I thought it would be fun for people to play with, especially those with children who are looking for new ways to introduce their kids to progamming. I did the bulk of the work specifying the grammar for this simple version of Logo on the flight back from LA to Seattle - which should give you a sense of how intuitive Mg is - and how productive the Intellipad authoring experience is. &lt;/P&gt;
&lt;P&gt;Given that Thanksgiving is just two days away I figured it would be patriotic (odd coming from an Aussie/Kiwi/Pom hybrid) to show how simple it is for this language to draw the United States flag - a design which obviously would make significant use of loops and nested loops.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&lt;IMG title="Logo Editor" alt="Logo Editor" src="http://blogs.msdn.com/photos/jason_hogg/images/9142865/500x163.aspx" mce_src="http://blogs.msdn.com/photos/jason_hogg/images/9142865/500x163.aspx"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The screenshot above shows the output from this program. The complete logo program listing is also included below so you can see how complex objects can be created using a simple grammar comprising of just 5 commands:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; - Commands - Commands perform actions such as moving or rotating.&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;Rotate n &lt;/STRONG&gt;- Rotate 'n' degrees&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;Draw n&lt;/STRONG&gt; - Draw a line 'n' pixels long&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;MoveAbs x, y&lt;/STRONG&gt; - Move to an absolute position&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;Move x,y&lt;/STRONG&gt; - Move to a position relative to last move / draw command&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; - Loops - Sets of instructions which are executde iteratively. Loops can be nested.&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;Loop n&lt;/STRONG&gt; &lt;STRONG&gt;{&lt;/STRONG&gt; [Command] &lt;STRONG&gt;}&lt;/STRONG&gt;*&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have attached the full source code for this so that you can play with this yourself. The source code is based on the PDC (October?) version of Oslo which you will have to first download from MSDN. The language could easily be extended to include color, line widths, other types of lines such as bezier curves etc - which should provide a good introduction for anyone interested.&amp;nbsp;Post pointers if you do anything fun with this.&lt;/P&gt;
&lt;P&gt;In addition to the formal grammar for my logo language (logo.mg) the .zip file also includes a WPF interpreter that interprets the parsed output of our logo programs and converts them into WPF Path Geometry syntax. There is also a simple editor that allows you to edit and run our Logo programs - providing a nice easy way to start teaching your children to program. Or for yourself to start modifying the language as described above. &lt;/P&gt;
&lt;P&gt;Enjoy!!! And (to those in America) Happy Thanksgiving... &lt;/P&gt;&lt;PRE&gt;// Logo (and Mg) sample program &lt;BR&gt;// Happy Thanksgiving! 
&lt;P&gt;// Move to top left&lt;BR&gt;MoveAbs 25,25 &lt;/P&gt;

&lt;P&gt;// Draw five rows of stars&lt;BR&gt;Loop 5&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp; // Draw ten columns of stars&lt;BR&gt;&amp;nbsp;&amp;nbsp; Loop 10&lt;BR&gt;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp; // Draw five points to make each star&lt;BR&gt;&amp;nbsp;&amp;nbsp; Loop 5&lt;BR&gt;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Rotate -54&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Draw 5&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Rotate 126&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Draw 5&lt;BR&gt;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp; Move 20 -1&lt;BR&gt;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp; Move -210,20&lt;BR&gt;}&lt;/P&gt;

&lt;P&gt;// Draw the lines next to the stars&lt;BR&gt;MoveAbs 430,25&lt;BR&gt;Rotate -90&lt;BR&gt;Loop 5&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp; // Lines are 5 pixels high&lt;BR&gt;&amp;nbsp;&amp;nbsp; Loop 5&lt;BR&gt;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Draw 200&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Move 200,1&lt;BR&gt;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp; Move 0 15&lt;BR&gt;}&lt;/P&gt;

&lt;P&gt;// Draw the lower lines on the flag&lt;BR&gt;MoveAbs 430,125&lt;BR&gt;Loop 5&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp; // Lines are 5 pixels high&lt;BR&gt;&amp;nbsp;&amp;nbsp; Loop 5&lt;BR&gt;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Draw 410&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Move 410,1&lt;BR&gt;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp; Move 0,15&lt;BR&gt;}&lt;/P&gt;

&lt;/PRE&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9142858" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/thehoggblog/attachment/9142858.ashx" length="867454" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/DSL/default.aspx">DSL</category><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/PDC2008/default.aspx">PDC2008</category><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/Software+Factories/default.aspx">Software Factories</category><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/Oslo/default.aspx">Oslo</category><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/_2600_quot_3B00_M_2600_quot_3B00_/default.aspx">&amp;quot;M&amp;quot;</category><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/Turtle+Graphics/default.aspx">Turtle Graphics</category></item><item><title>patterns &amp; practices Improving Web Services Security: Now Available!</title><link>http://blogs.msdn.com/thehoggblog/archive/2008/06/20/patterns-practices-improving-web-services-security-now-available.aspx</link><pubDate>Fri, 20 Jun 2008 17:51:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8625462</guid><dc:creator>Jason Hogg</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/thehoggblog/comments/8625462.aspx</comments><wfw:commentRss>http://blogs.msdn.com/thehoggblog/commentrss.aspx?PostID=8625462</wfw:commentRss><wfw:comment>http://blogs.msdn.com/thehoggblog/rsscomments.aspx?PostID=8625462</wfw:comment><description>&lt;P&gt;Over the last 12 months we have had a lot of people who used the &lt;EM&gt;Web Service Security - Scenarios, Patterns and Implementation Guidance&lt;/EM&gt; ask us where the implementation guidance for WCF was. Great news. JD Meier, Jason Taylor, Prashant Bansode and Rob Boucher and the rest of his P&amp;amp;P team have just released their guide which includes Security Fundamentals for Web Services, WCF Security Fundamentals and Scenario specific guidance. Great stuff - and a must read for anyone designing secure distributed systems based on WCF. Available from: &lt;A href="http://www.codeplex.com/WCFSecurityGuide" mce_href="http://www.codeplex.com/WCFSecurityGuide"&gt;http://www.codeplex.com/WCFSecurityGuide&lt;/A&gt; &lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8625462" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/Web+Service+Security/default.aspx">Web Service Security</category><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/Security/default.aspx">Security</category><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/Design+Patterns/default.aspx">Design Patterns</category><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/C_2300_/default.aspx">C#</category></item><item><title>WhoIs Shenanigans</title><link>http://blogs.msdn.com/thehoggblog/archive/2008/03/31/whois-shenanigans.aspx</link><pubDate>Tue, 01 Apr 2008 03:29:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8346967</guid><dc:creator>Jason Hogg</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/thehoggblog/comments/8346967.aspx</comments><wfw:commentRss>http://blogs.msdn.com/thehoggblog/commentrss.aspx?PostID=8346967</wfw:commentRss><wfw:comment>http://blogs.msdn.com/thehoggblog/rsscomments.aspx?PostID=8346967</wfw:comment><description>&lt;P&gt;I am sure that everyone has used a WhoIs utility (such as &lt;A href="http://www.internic.org/whois.html" mce_href="http://www.internic.org/whois.html"&gt;http://www.internic.org/whois.html&lt;/A&gt;) for querying the owner of a domain name such as microsoft.com. There is however an alternative to these Web forms which provides more information allowing you to search not just for strings matching a domain name, but also for strings matching registered hostnames of domain names. This provides hysterical insight into the minds of some Webmasters. For a laugh take a look at some of these hostnames registered with microsoft.com or google.com in them. &lt;/P&gt;
&lt;P&gt;MICROSOFT.COM.WILL.LIVE.FOREVER.BECOUSE.UNIXSUCKS.COM&lt;BR&gt;MICROSOFT.COM.WILL.BE.BEATEN.WITH.MY.SPANNER.NET&lt;BR&gt;MICROSOFT.COM.SOFTWARE.IS.NOT.USED.AT.REG.RU&lt;BR&gt;MICROSOFT.COM.SHOULD.GIVE.UP.BECAUSE.LINUXISGOD.COM&lt;BR&gt;MICROSOFT.COM.IS.NOT.HOSTED.BY.ACTIVEDOMAINDNS.NET&lt;BR&gt;MICROSOFT.COM.IS.GOD.BECOUSE.UNIXSUCKS.COM&lt;BR&gt;MICROSOFT.COM.HAS.ITS.OWN.CRACKLAB.COM&lt;BR&gt;MICROSOFT.COM&lt;/P&gt;
&lt;P&gt;GOOGLE.COM.ZOMBIED.AND.HACKED.BY.WWW.WEB-HACK.COM&lt;BR&gt;GOOGLE.COM.YAHOO.COM.MYSPACE.COM.YOUTUBE.COM.FACEBOOK.COM.THEYSUCK.DNSABOUT.COM&lt;BR&gt;GOOGLE.COM.IS.NOT.HOSTED.BY.ACTIVEDOMAINDNS.NET&lt;BR&gt;GOOGLE.COM.IS.HOSTED.ON.PROFITHOSTING.NET&lt;BR&gt;GOOGLE.COM.ACQUIRED.BY.CALITEC.NET&lt;BR&gt;GOOGLE.COM&lt;/P&gt;
&lt;P&gt;To see the complete list (r rated) try running the code yourself. Post a response with your funniest hostname or domain names other than these two that are particularly funny.&lt;/P&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;using&lt;/FONT&gt;&lt;FONT size=2&gt; System;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;using&lt;/FONT&gt;&lt;FONT size=2&gt; System.Collections.Generic;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;using&lt;/FONT&gt;&lt;FONT size=2&gt; System.Linq;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;using&lt;/FONT&gt;&lt;FONT size=2&gt; System.Text;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;using&lt;/FONT&gt;&lt;FONT size=2&gt; System.Net.Sockets;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;using&lt;/FONT&gt;&lt;FONT size=2&gt; System.IO; &lt;/P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;namespace&lt;/FONT&gt;&lt;FONT size=2&gt; WhoIsQuery&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp; class&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;Program&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; static&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;void&lt;/FONT&gt;&lt;FONT size=2&gt; Main(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;string&lt;/FONT&gt;&lt;FONT size=2&gt;[] args)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // A query that results in more than one result lists all possible results&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // so that a more precise query can be entered. &lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // A query with only one result returns just that result. &lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Send request to WhoIs Server&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;&lt;FONT color=#008000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;Console&lt;/FONT&gt;&lt;FONT size=2&gt;.WriteLine(&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"Contacting Internic"&lt;/FONT&gt;&lt;FONT size=2&gt;);&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;&lt;FONT color=#008000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;TcpClient&lt;/FONT&gt;&lt;FONT size=2&gt; client = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;TcpClient&lt;/FONT&gt;&lt;FONT size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"whois.internic.net"&lt;/FONT&gt;&lt;FONT size=2&gt;, 43);&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;&lt;FONT color=#008000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;StreamWriter&lt;/FONT&gt;&lt;FONT size=2&gt; writer = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;StreamWriter&lt;/FONT&gt;&lt;FONT size=2&gt;(client.GetStream());&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#008000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;writer.WriteLine(&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"microsoft.com"&lt;/FONT&gt;&lt;FONT size=2&gt;);&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#008000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;writer.Flush();&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Retrieve response&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;&lt;FONT color=#008000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;StringBuilder&lt;/FONT&gt;&lt;FONT size=2&gt; output = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;StringBuilder&lt;/FONT&gt;&lt;FONT size=2&gt;();&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;&lt;FONT color=#008000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;StreamReader&lt;/FONT&gt;&lt;FONT size=2&gt; reader = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;StreamReader&lt;/FONT&gt;&lt;FONT size=2&gt;(client.GetStream());&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#008000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;do&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;
&lt;P&gt;&lt;FONT color=#008000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#008000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;output.Append(reader.ReadLine() + &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;Environment&lt;/FONT&gt;&lt;FONT size=2&gt;.NewLine);&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#008000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;}&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#008000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;while&lt;/FONT&gt;&lt;FONT size=2&gt; (!reader.EndOfStream); &lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;&lt;FONT color=#008000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;Console&lt;/FONT&gt;&lt;FONT size=2&gt;.WriteLine(output);&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;&lt;FONT color=#008000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;Console&lt;/FONT&gt;&lt;FONT size=2&gt;.ReadLine();&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#008000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;/FONT&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8346967" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://blogs.msdn.com/thehoggblog/archive/tags/Fun/default.aspx">Fun</category></item></channel></rss>