<?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>Peer Channel Team Blog</title><link>http://blogs.msdn.com/peerchan/default.aspx</link><description /><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Peer Channel Official Protocol Documentation Link</title><link>http://blogs.msdn.com/peerchan/archive/2008/04/30/peer-channel-official-protocol-documentation-now-online.aspx</link><pubDate>Thu, 01 May 2008 07:13:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8446206</guid><dc:creator>peerchan</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/peerchan/comments/8446206.aspx</comments><wfw:commentRss>http://blogs.msdn.com/peerchan/commentrss.aspx?PostID=8446206</wfw:commentRss><description>Check it out here: &amp;nbsp;&lt;A href="http://msdn.microsoft.com/en-us/library/cc219453.aspx" mce_href="http://msdn.microsoft.com/en-us/library/cc219453.aspx"&gt;http://msdn.microsoft.com/en-us/library/cc219453.aspx&lt;/A&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8446206" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/peerchan/archive/tags/Updates_2F00_News/default.aspx">Updates/News</category><category domain="http://blogs.msdn.com/peerchan/archive/tags/Related+Links/default.aspx">Related Links</category></item><item><title>New to WCF programming??</title><link>http://blogs.msdn.com/peerchan/archive/2008/01/24/new-to-wcf-programming.aspx</link><pubDate>Fri, 25 Jan 2008 04:21:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7230372</guid><dc:creator>peerchan</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/peerchan/comments/7230372.aspx</comments><wfw:commentRss>http://blogs.msdn.com/peerchan/commentrss.aspx?PostID=7230372</wfw:commentRss><description>&lt;P&gt;Check out Clemens Vasters' paper&amp;nbsp;introducing WCF up on &amp;nbsp;&lt;A href="http://msdn2.microsoft.com/en-us/library/aa480190.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/aa480190.aspx"&gt;http://msdn2.microsoft.com/en-us/library/aa480190.aspx&lt;/A&gt;...&lt;/P&gt;
&lt;P&gt;Also, some presentations and hands-on labs at &lt;A href="http://www.dotnet-university.com/CourseMaterials.aspx"&gt;http://www.dotnet-university.com/CourseMaterials.aspx&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;-shalini.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7230372" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/peerchan/archive/tags/Peer+Channel+Basics_3A00_+For+the+Beginner/default.aspx">Peer Channel Basics: For the Beginner</category></item><item><title>Configuring Peer Channel: With/Without App.config</title><link>http://blogs.msdn.com/peerchan/archive/2008/01/23/Configuring-Peer-Channel_3A00_-With_2F00_Without-App_2E00_config.aspx</link><pubDate>Thu, 24 Jan 2008 01:44:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7213046</guid><dc:creator>peerchan</dc:creator><slash:comments>9</slash:comments><comments>http://blogs.msdn.com/peerchan/comments/7213046.aspx</comments><wfw:commentRss>http://blogs.msdn.com/peerchan/commentrss.aspx?PostID=7213046</wfw:commentRss><description>&lt;P&gt;So now that we know what the NetPeerTcpBinding is how you can end up using Peer Channel in your standard WCF application, let's take a look at how to configure peer channel.&amp;nbsp;We&amp;nbsp;follow the standard WCF&amp;nbsp;(.NET really)&amp;nbsp;pattern of allowing configuration through&amp;nbsp;an&amp;nbsp;App.config file for your application&amp;nbsp;or imperatively&amp;nbsp;within the code itself. Which way you choose to go really depends on your needs - if you expect your endpoints/configuration to change a lot and want that aspect flexible etc(eg you use a customResolver for discovery and expect to move it around etc) you'd want to minimize code changes and prefer to change these settings in your config file directly. On the other hand, if you dont really expect to modify your source code that often and dont really want an App.config file, you can opt to just configure everything in code itself. Peer Channel (NetPeerTcpbinding)&amp;nbsp;supports both, to provide a programming model consistent with the rest of WCF. &lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Using App.config:&lt;/U&gt; &lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;The following example attempts to configure a Peer Channel endpoint, with endpointAddress = "&lt;SPAN style="COLOR: blue"&gt;&lt;FONT face="Courier New"&gt;net.p2p://ChatMesh/chat"; &lt;/FONT&gt;&lt;FONT face=Arial color=#000000&gt;other endpoint information also is added to the endpoint section of the config file, including fully qualified contract type that is associated with the endpoint, name of config file section that configures the specific binding used, and of course also the&amp;nbsp;type of the binding being used.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="COLOR: blue"&gt;&lt;FONT color=#000000&gt;All binding configuration (in our case, peer channel (NetPeerTcpbinding)-specific ) settings are in the configuration section corresponding to the one specified in the endpoint section above. (&lt;EM&gt;Note: Just in case you are wondering, Visual Studio 8 comes preconfigured with xml information for ServiceModel so intellisense would work and you dont really have to know before hand all the various properties etc.. a quick way to confirm is to check your schema file from the VS install here: C:\Program Files\Microsoft Visual Studio 9.0\Xml\Schemas\DotNetConfig.xsd and search for serviceModel definitions..) &lt;/EM&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="COLOR: blue"&gt;&lt;FONT color=#000000&gt;In the bindings section of serviceModel configuration, we specify settings for NetPeerTcpBinding as i show below. &lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;SPAN style="COLOR: blue"&gt;&lt;FONT color=#000000&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;?&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;xml&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;version&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;"&lt;SPAN style="COLOR: blue"&gt;1.0&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;encoding&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;utf-8&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt; ?&amp;gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;configuration&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;system.serviceModel&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;client&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;!--&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; chat instance participating in the mesh &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;--&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;endpoint&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;name&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;"&lt;FONT color=#0000ff&gt;Peer&lt;/FONT&gt;&lt;SPAN style="COLOR: blue"&gt;Endpoint&lt;/SPAN&gt;"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;address&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;"&lt;SPAN style="COLOR: blue"&gt;net.p2p://ChatMesh/chat&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;"&lt;SPAN style="COLOR: blue"&gt;netPeerTcpBinding&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;bindingConfiguration&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;"&lt;FONT color=#0000ff&gt;PeerBinding&lt;/FONT&gt;"&lt;SPAN style="COLOR: blue"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;contract&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;"&lt;SPAN style="COLOR: blue"&gt;Microsoft.ServiceModel.Samples.IChat&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;endpoint&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;client&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;bindings&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;netPeerTcpBinding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;name&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;"&lt;FONT color=#0000ff&gt;Peer&lt;/FONT&gt;&lt;SPAN style="COLOR: blue"&gt;Binding&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;port&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;0&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;resolver&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;mode&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;"&lt;SPAN style="COLOR: blue"&gt;Auto&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;/&amp;gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="COLOR: blue"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="COLOR: blue"&gt;&lt;o:p&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;security&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;mode&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;=&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt;"&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;None&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt;"&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt; /&amp;gt;&lt;/P&gt;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;netPeerTcpBinding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;bindings&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;system.serviceModel&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;configuration&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&lt;FONT color=#000000&gt;It all comes together when in the code, you specify the endpoint name from the config file to the CreateChannel constructor, like so: &lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;SPAN style="COLOR: blue"&gt;&lt;FONT size=2&gt;&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;&lt;FONT size=2&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;// Construct InstanceContext to handle messages on callback interface. &lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;// An instance of ChatApp is created and passed to the InstanceContext.&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;
&lt;P&gt;InstanceContext site = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; InstanceContext(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; ChatApp());&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;&lt;FONT color=#008000&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;// Create the participant with the given endpoint configuration. &lt;FONT color=#008000 size=2&gt;Each participant opens a duplex channel to the mesh.&amp;nbsp;P&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;articipant is an instance of the chat application that has opened a channel to the mesh&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;ChannelFactory&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;IChatChannel&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;gt; factory = &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;DuplexChannelFactory&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;IChatChannel&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;gt;(site, &lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"PeerEndpoint"&lt;/FONT&gt;&lt;FONT size=2&gt;);&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;&lt;FONT face=Arial color=#000000&gt;Note: Notice that the above example assumes that you are creating a duplexChannel for your application and the client itself is the sender/receiver. You can certainly choose to configure your application such that instead of a duplex channel, you have 1 separate sender&amp;nbsp;and multiple clients (receivers). Check out the &lt;A class="" href="http://msdn2.microsoft.com/en-us/library/ms751426.aspx" target=_blank mce_href="http://msdn2.microsoft.com/en-us/library/ms751426.aspx"&gt;Default sample&lt;/A&gt; for an idea on how to configure the service/client separately in such a case. &lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;&lt;FONT face=Arial color=#000000&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;/SPAN&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;&lt;STRONG&gt;&lt;FONT color=#000000&gt;&lt;FONT face=Arial&gt;&lt;U&gt;Imperative configuration (Via code and not through the App.config file):&lt;/U&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;&lt;STRONG&gt;&lt;FONT face=Arial color=#000000&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;&lt;FONT face=Arial color=#000000&gt;The same configuration above can be achieved through setting the properties on NetPeerTcpbinding programmatically. So programmatically, the settings above would look as under:&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;&lt;FONT face=Arial color=#000000&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;&lt;FONT face=Arial color=#000000&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;&lt;FONT size=2&gt;&lt;FONT color=#000000&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;InstanceContext&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; site = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;InstanceContext&lt;/SPAN&gt;(&lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; ChatApp());&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;NetPeerTcpBinding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;nbsp;peerBinding = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;NetPeerTcpBinding&lt;/SPAN&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;peerBinding.Security.Mode = &lt;SPAN style="COLOR: #2b91af"&gt;SecurityMode&lt;/SPAN&gt;.None;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;ChannelFactory&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;IChatChannel&amp;gt; factory = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;DuplexChannelFactory&lt;/SPAN&gt;&amp;lt;IChatChannel&amp;gt;(site, peerBinding);&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/SPAN&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;&lt;FONT face=Arial color=#000000&gt;That's all there is to it :)- (&lt;EM&gt;unless of course you would like to use the default custom resolver, in which case check out the&amp;nbsp;&lt;/EM&gt;&lt;A class="" href="http://msdn2.microsoft.com/en-us/library/ms751502.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/ms751502.aspx"&gt;&lt;FONT color=#006666&gt;&lt;EM&gt;scenario sample on msdn&lt;/EM&gt;&lt;/FONT&gt;&lt;/A&gt;&amp;nbsp;&lt;EM&gt;on what&lt;/EM&gt; &lt;EM&gt;properties to configure&lt;/EM&gt;). Hopefully this will help answer some common questions around configuration and also how to convert your app from using App.config to pure code. &lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;&lt;FONT face=Arial color=#000000&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;&lt;FONT face=Arial color=#000000&gt;As always, feedback welcome and appreciated :)..&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;&lt;FONT face=Arial color=#000000&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;&lt;FONT face=Arial color=#000000&gt;-shalini.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;&lt;FONT face=Arial color=#000000&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;&lt;FONT size=2&gt;&lt;FONT color=#000000&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7213046" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/peerchan/archive/tags/Peer+Channel+Basics_3A00_+For+the+Beginner/default.aspx">Peer Channel Basics: For the Beginner</category></item><item><title>Getting started- A Fresh look at Peer Channel (NetPeerTcpBinding)</title><link>http://blogs.msdn.com/peerchan/archive/2007/12/14/getting-started-a-fresh-look-windows-vista-peer-channel.aspx</link><pubDate>Sat, 15 Dec 2007 03:21:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6773681</guid><dc:creator>peerchan</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/peerchan/comments/6773681.aspx</comments><wfw:commentRss>http://blogs.msdn.com/peerchan/commentrss.aspx?PostID=6773681</wfw:commentRss><description>&lt;P&gt;Allright,&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;the general consensus amongst new adopters/potential customers&amp;nbsp;seems to be, that our documentation on msdn&amp;nbsp;seems to be&amp;nbsp;not all that crystal-clear,&amp;nbsp;especially for a new comer, to Peer Channel. And that uptil now, we have been targetting advanced scenarios in our blog - Since it might take a while for us to get stuff added/edited up on msdn, we decided to get some basic stuff up on the blog. So, now shall follow some posts about Peer Channel basics - hopefully, from what i think is scratch :).Feel free to comment on the topics covered and on topics you would like covered here in this section..&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Where you will find us:&lt;/STRONG&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Peer Channel is enabled by default on Windows Vista - as is all of WCF. So you no longer have to download the runtime components (primarily System.ServiceModel.dll) separately or enable it explicitly. &lt;/P&gt;
&lt;P&gt;So all you really need to get started is to add references to &lt;A class="" href="http://msdn2.microsoft.com/en-us/library/system.servicemodel.aspx" target=_blank mce_href="http://msdn2.microsoft.com/en-us/library/system.servicemodel.aspx"&gt;System.ServiceModel&lt;/A&gt;.dll in your project &amp;amp;&amp;nbsp;you should have access to our classes. &lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;What are we (in terms of WCF): &lt;/STRONG&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;We are essentially a virtual WCF channel - an abstraction built on top of the WCF TCP channel that provides a means for peer-peer communication, without the application having to worry about it. Most of this functionality is&amp;nbsp;exposed to a&amp;nbsp;WCF application through the &lt;A class="" href="http://msdn2.microsoft.com/en-us/library/ms731318.aspx" target=_blank mce_href="http://msdn2.microsoft.com/en-us/library/ms731318.aspx"&gt;NetPeerTcpBinding&lt;/A&gt;. It is through the NetPeerTcpBinding that you can configure and query static and instance properties like, IsPnrpAvailable, regular properties that can be set on any WCF binding (eg timeouts), and peer-channel specific properties like Resolver (name resolution), Security options etc..&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;STRONG&gt;Default behavior/Properties:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;STRONG&gt;(a) Name Resolution: &lt;/STRONG&gt;Our default peer name resolution mechanism uses a resolver based on &lt;A class="" href="http://technet.microsoft.com/en-us/library/bb726971.aspx" mce_href="http://technet.microsoft.com/en-us/library/bb726971.aspx"&gt;PNRP&lt;/A&gt; the PnrpResolver. This is available on XPSP2 (with Networking pack installed) and by default on Windows Vista. Incase, you dont wish to use Pnrp, you have two other options - &lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i) DefaultCustomResolver: a WCF TCP service-based name resolver; an implementation we provide out-of-the-box. All you need to do is configure the Resolver property on the NetPeerTcpbinding instance. There are some more configuration steps and our &lt;A class="" href="http://msdn2.microsoft.com/en-us/library/ms751502.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/ms751502.aspx"&gt;scenario sample on msdn&lt;/A&gt; shows how to configure your app to use this resolver.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ii) Custom Resolver - There are times where you might to use your own discovery resolver - for this you can plug in your custom name resolver again by specifying the NetPeerTcpBinding's resolver property with the type of your resolver class. We also ship&amp;nbsp;a custom resolver implementation (again TCP-based) &lt;A class="" href="http://msdn2.microsoft.com/en-us/library/ms751466.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/ms751466.aspx"&gt;sample&lt;/A&gt; for reference. &lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;STRONG&gt;(b) Security&lt;/STRONG&gt;: By default, Peer channel uses password-based authentication for communication amongst peers. So make sure to configure your password on the instance of channelFactory through teh Credential.Peer.MeshPassword property. The certificates&amp;nbsp;used in this&amp;nbsp;authentication are auto-generated and need not be generated/set explicitly, but your application can do so using the Credential.Peer.Certificate property. &lt;A class="" href="http://msdn2.microsoft.com/en-us/library/ms751534.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/ms751534.aspx"&gt;Our samples&lt;/A&gt; show best how this and other security modes can be used with Peer Channel.&amp;nbsp;We'll also&amp;nbsp;cover more on this in a later post..&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;STRONG&gt;(c) Listen port: &lt;/STRONG&gt;Ports on which your node is listening are auto-generated. So it is really simple for you to run multiple instances of your application on the same machine without any configuration changes. If you would like to explicitly set the port your application should listen on, use the Port property on the netPeerTcpBinding instance.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;STRONG&gt;(d) Listen IPAddress: &lt;/STRONG&gt;By default, Peer Channel uses all available IPv4/IPv6 addresses to bind to (including link-local/global IPv6 addresses). However, if you choose, you can make it listen on specific IP addresses using the ListenIPAddress property on binding instance.&lt;/P&gt;
&lt;P mce_keep="true"&gt;Hopefully, I've covered some basics, and this post, coupled with the samples on msdn, should help you get started with writing your first Peer Channel app :). Stay tuned for more fun stuff :)&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=6773681" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/peerchan/archive/tags/Peer+Channel+Basics_3A00_+For+the+Beginner/default.aspx">Peer Channel Basics: For the Beginner</category></item><item><title>Limited Message Distribution: A Survey of Flavors</title><link>http://blogs.msdn.com/peerchan/archive/2007/08/30/limited-message-distribution-a-survey-of-flavors.aspx</link><pubDate>Fri, 31 Aug 2007 04:46:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4658510</guid><dc:creator>peerchan</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/peerchan/comments/4658510.aspx</comments><wfw:commentRss>http://blogs.msdn.com/peerchan/commentrss.aspx?PostID=4658510</wfw:commentRss><description>&lt;P&gt;One our very, very most frequently asked questions about PeerChannel takes the following form:&lt;/P&gt;
&lt;P&gt;"I like the easy way in which I can send messages to everyone one in the mesh, but sometimes, I just want to send a message to [one person, my neighbor, a subset]&amp;nbsp;in the mesh.&amp;nbsp; How do I do that?"&lt;/P&gt;
&lt;P&gt;PeerChannel is by design&amp;nbsp;a broadcast mesh, and so is built from the ground up with the intent that messages sent by members of the mesh are received by all members of the mesh.&amp;nbsp; Naturally, this means that PeerChannel is best suited for applications like data broadcast, chat rooms, collaboration, etc.&amp;nbsp; However, in many applications, there will be an occasional need for more limited communication.&amp;nbsp; Although there are variety of ways to limit message distribution, PeerChannel has no built-in method to send a message directly to another member of the mesh, but this is very easy to accomplish.&amp;nbsp; Before we examine options, be sure&amp;nbsp;you ask yourself the following three questions when you discover a scenario in which you need to limit message distribution:&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;WHO needs to receive this message?&amp;nbsp; Just one neighbor node?&amp;nbsp; A node somewhere else in the mesh?&amp;nbsp; Half the mesh?&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;HOW OFTEN will this message be sent?&amp;nbsp; &lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;What kind of BANDWIDTH will this message use?&amp;nbsp; &lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;With these three questions answered, let us now discuss the different ways to limit message distribution with PeerChannel:&lt;/P&gt;
&lt;P&gt;1) &lt;STRONG&gt;MessagePropagationFilter &lt;/STRONG&gt;- This method is used at PeerChannel's transport layer to determine whether or not a message should be deliver to the local node and/or propagated throughout the mesh.&amp;nbsp; See our blog entry for more details.&amp;nbsp; Typically, this should only be used when propagating the message is determined by the actual content of the message, or other very specific scenarios.&lt;/P&gt;
&lt;P&gt;2) &lt;STRONG&gt;HopCount&amp;nbsp;&lt;/STRONG&gt;- Attribute used to determine how many times a message should be propagated ("hops") before being dropped.&amp;nbsp; Once again, see our blog entry for more details.&amp;nbsp; This is perfect for sending a message to immediate neighbors or neighbors within a few hops.&lt;/P&gt;
&lt;P&gt;3) &lt;STRONG&gt;Adding a local filter to the message contract &lt;/STRONG&gt;- If the nodes in your mesh each have an individual ID, you can specify a destination ID in the implementation of your message, and have all the nodes ignore messages marked for delivery to another node.&amp;nbsp; This method is perfect for sending to individual members of the mesh, as long as the messages aren't too big or frequent.&amp;nbsp; This is because the mesh will still be used to transport the message, which means that you don't suffer the overhead of setting up a new connection.&amp;nbsp; On the other hand, there will be an efficiency loss as the message is sent many times throughout the entire mesh.&amp;nbsp; Here is a simple example taken from a Chat scenario: I want to send a message to only one person in the mesh, which we will call "whisper".&amp;nbsp; I add a Whisper operation to my contact:&lt;/P&gt;&lt;FONT size=2&gt;
&lt;P&gt;[&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;OperationContract&lt;/FONT&gt;&lt;FONT size=2&gt;(IsOneWay = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;true&lt;/FONT&gt;&lt;FONT size=2&gt;)]&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;void&lt;/FONT&gt;&lt;FONT size=2&gt; Whisper(&lt;FONT color=#008080&gt;&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; &lt;/FONT&gt;&lt;FONT color=#000000&gt;WhisperMember, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;ChatMessage&lt;/FONT&gt;&lt;FONT size=2&gt; msg)&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;BR&gt;I then implement the Whisper function as follows:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#0000ff size=2&gt;public&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; Chat(&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt;&lt;FONT color=#008080&gt; &lt;/FONT&gt;&lt;FONT color=#000000&gt;WhisperMember, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;ChatMessage&lt;/FONT&gt;&lt;FONT size=2&gt; msg)&lt;BR&gt;{&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if&lt;/FONT&gt;&lt;FONT size=2&gt; (WhisperMember != &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;this&lt;/FONT&gt;&lt;FONT size=2&gt;.member)&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console&lt;/FONT&gt;&lt;FONT size=2&gt;.WriteLine(&lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"[{0}] {1}"&lt;/FONT&gt;&lt;FONT size=2&gt;, msg.msgSource, msg.msgTxt);&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;}&lt;/P&gt;&lt;/FONT&gt;
&lt;P&gt;4) &lt;STRONG&gt;Setting up a direct connection&lt;/STRONG&gt; - You can send connection info over the mesh and then set up a direct connection of your choosing to send/receive messages.&amp;nbsp; This is preferable for long-lasting, high-bandwidth connections between two nodes.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;So how do you know which one to choose?&amp;nbsp; It depends on your answers to those three questions.&amp;nbsp; Let us&amp;nbsp;revisit them and see what&amp;nbsp;our answers tell us about which option to use&lt;STRONG&gt;:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;WHO:&lt;BR&gt;&lt;/STRONG&gt;&lt;EM&gt;Complex subset of mesh: &lt;/EM&gt;MessagePropagationFilter&lt;BR&gt;&lt;EM&gt;Neighbors within a certain vicinity&lt;/EM&gt;: HopCount&amp;nbsp;&lt;BR&gt;&lt;EM&gt;Individual node: &lt;/EM&gt;Local Filter or Direction Connection&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;HOW OFTEN:&lt;BR&gt;&lt;/STRONG&gt;&lt;EM&gt;Very frequent&lt;/EM&gt;:&amp;nbsp;Direct Connection, HopCount, MessagePropagationFilter are&amp;nbsp;preferable&lt;BR&gt;&lt;EM&gt;Occasional&lt;/EM&gt;: Local Filter&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;BANDWIDTH USE:&lt;BR&gt;&lt;/STRONG&gt;&lt;EM&gt;High&lt;/EM&gt;: Direct Connection preferred, less advisable to use MessagePropagationFilter or Local Filter&lt;BR&gt;&lt;EM&gt;Low: &lt;/EM&gt;Any, Direct Connect probably not needed.&lt;/P&gt;
&lt;P&gt;Of course, many of these questions do not have black-and-white answers, so each specific application and scenario will be unique.&amp;nbsp; But the concepts remain the same.&amp;nbsp; I hope this helps a little in helping determine which method is best for you.&amp;nbsp; Thanks! -Jonathan&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=4658510" width="1" height="1"&gt;</description></item><item><title>Modifying PeerChat to use Synchronization</title><link>http://blogs.msdn.com/peerchan/archive/2007/08/30/modifying-peerchat-to-use-synchronization.aspx</link><pubDate>Fri, 31 Aug 2007 03:27:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4657762</guid><dc:creator>peerchan</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/peerchan/comments/4657762.aspx</comments><wfw:commentRss>http://blogs.msdn.com/peerchan/commentrss.aspx?PostID=4657762</wfw:commentRss><description>&lt;P align=left&gt;We return to our favorite application, the Chat room.&amp;nbsp; In this example, we want members who enter and leave the mesh to be able to catch up on what was said while they were gone, so all chat messages will be synchronized throughout the mesh.&amp;nbsp; This will require writing a simple synchronization layer on top of PeerChannel in our PeerChat example.&lt;/P&gt;
&lt;P align=left&gt;&lt;EM&gt;Note: We are going to start off by NOT enforce ordering of records, but we will discuss that at the end.&amp;nbsp; In&amp;nbsp;a Chat scenario,&amp;nbsp;you would definitely want your synchronized data to be ordered as well. &lt;/EM&gt;&lt;/P&gt;
&lt;P align=left&gt;Let us begin by walking through the 5 steps mentioned in our previous blog entry.&lt;/P&gt;
&lt;P align=left&gt;1. &lt;STRONG&gt;Determine the Data Set &lt;/STRONG&gt;- Since every member of the mesh will need to view the entire chat log, and since chat logs are not typically too large, we will have every member of the mesh store the entire chat conversation in a local data store called &lt;EM&gt;ChatLog&lt;/EM&gt;.&lt;/P&gt;
&lt;P align=left&gt;2.&amp;nbsp; &lt;STRONG&gt;Determine the Data Structure&lt;/STRONG&gt; - We will use a typical Dictionary structure for chats.&amp;nbsp; Keys will be chat message IDs (GUIDs), and the records will be a ChatMessage object, containing the message ID, source ID (name of person who sent the chat), and the Chat message itself (a string).&amp;nbsp; Note that this structure itself is not ordered, so we will need to do some additional work later on to satisfy that constraint.&amp;nbsp; Note that we also include a hopcount field, since all sync messages will only be send to immediate neighbors.&lt;/P&gt;&lt;FONT size=2&gt;
&lt;P&gt;[&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;MessageContract&lt;/FONT&gt;&lt;FONT size=2&gt;]&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;class&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;ChatMessage&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;{&lt;BR&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;[&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;MessageBodyMember&lt;/FONT&gt;&lt;FONT size=2&gt;]&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;string&lt;/FONT&gt;&lt;FONT size=2&gt; msgTxt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;[&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;MessageBodyMember&lt;/FONT&gt;&lt;FONT size=2&gt;]&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;Guid&lt;/FONT&gt;&lt;FONT size=2&gt; msgId;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;[&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;MessageBodyMember&lt;/FONT&gt;&lt;FONT size=2&gt;]&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;string&lt;/FONT&gt;&lt;FONT size=2&gt; msgSource;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;[&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;PeerHopCount&lt;/FONT&gt;&lt;FONT size=2&gt;]&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;int&lt;/FONT&gt;&lt;FONT size=2&gt; hops;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public&lt;/FONT&gt;&lt;FONT size=2&gt; ChatMessage() { }&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public&lt;/FONT&gt;&lt;FONT size=2&gt; ChatMessage (&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;Guid&lt;/FONT&gt;&lt;FONT size=2&gt; id, &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;string&lt;/FONT&gt;&lt;FONT size=2&gt; text, &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;string&lt;/FONT&gt;&lt;FONT size=2&gt; source)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; msgId = id;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; msgTxt = text;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; msgSource = source;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT size=2&gt;hops = 1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Immediate neighbors only &lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;}&lt;/P&gt;&lt;/FONT&gt;
&lt;P align=left&gt;3. Sync protocol - We will use a&amp;nbsp;relatively simple, 6-step&amp;nbsp;algorithm as follows:&lt;/P&gt;
&lt;P align=left&gt;I) &lt;STRONG&gt;MessageIDRequest:&lt;/STRONG&gt; Syncing Node requests a list of message IDs from its immediate neighbors&lt;BR&gt;II)&amp;nbsp;&lt;STRONG&gt;MessageIDResponse:&lt;/STRONG&gt; Each neighbor responds with a complete list of message IDs contained in its local data store&lt;BR&gt;III) The syncing Node examines the list of message IDs and generates a list of IDs corresponding to messages missing from its local data store.&lt;BR&gt;IV) &lt;STRONG&gt;MessageContentRequest:&lt;/STRONG&gt; The syncing sends its neighbors a content request with a list of message IDs.&lt;BR&gt;V) &lt;STRONG&gt;MessageContentResponse:&lt;/STRONG&gt; Each neighbor sends back the complete messages corresponding to the message IDs containing in the content request.&lt;BR&gt;VI) Node A receives the&amp;nbsp;responses containing the messages and adds them to its local data store&lt;/P&gt;
&lt;P align=left&gt;This method has two main advantages: the syncing node only receives messages it knows are missing from its local data store, and it can be easily modified such that no two neighbors are required to send back the same messages, reducing duplication.&amp;nbsp; For example, if the syncing node is joining for the first time, and finds out that it is missing messages 1-9, it can request each of its three neighbors to send the content of 3 messages, thereby distributing the sync load and minimized excessive bandwidth use.&amp;nbsp; (This last optimization will be left out of this example for simplicity.)&lt;/P&gt;
&lt;P align=left&gt;&amp;nbsp;4. &lt;STRONG&gt;New Message Contract:&lt;/STRONG&gt; Below is a interface based off the PeerChat sample in the .NET 3.0 SDK.&amp;nbsp; After the standard Join, Chat, Leave operations, the sync messages definitions follow.&lt;/P&gt;&lt;FONT size=2&gt;
&lt;P&gt;[&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;ServiceContract&lt;/FONT&gt;&lt;FONT size=2&gt;(Namespace = &lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"http://Microsoft.ServiceModel.Samples"&lt;/FONT&gt;&lt;FONT size=2&gt;, CallbackContract = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;typeof&lt;/FONT&gt;&lt;FONT size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;IChat&lt;/FONT&gt;&lt;FONT size=2&gt;))]&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;interface&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;IChat&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;OperationContract&lt;/FONT&gt;&lt;FONT size=2&gt;(IsOneWay = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;true&lt;/FONT&gt;&lt;FONT size=2&gt;)]&amp;nbsp; // Sent when a node joins the mesh&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; void&lt;/FONT&gt;&lt;FONT size=2&gt; Join(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;string&lt;/FONT&gt;&lt;FONT size=2&gt; member);&lt;/FONT&gt;&lt;/P&gt;
&lt;P align=left&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;[&lt;FONT color=#008080 size=2&gt;OperationContract&lt;/FONT&gt;&lt;FONT size=2&gt;(IsOneWay = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;true&lt;/FONT&gt;&lt;FONT size=2&gt;)]&amp;nbsp; // Send to indicate that the node is leaving the mesh&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; void&lt;/FONT&gt;&lt;FONT size=2&gt; Leave(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;string&lt;/FONT&gt;&lt;FONT size=2&gt; member);&lt;/FONT&gt;&lt;/P&gt;
&lt;P align=left&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;[&lt;FONT color=#008080 size=2&gt;OperationContract&lt;/FONT&gt;&lt;FONT size=2&gt;(IsOneWay = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;true&lt;/FONT&gt;&lt;FONT size=2&gt;)]&amp;nbsp; // A chat message&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; void&lt;/FONT&gt;&lt;FONT size=2&gt; Chat(&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;ChatMessage&lt;/FONT&gt;&lt;FONT size=2&gt; msg);&lt;/FONT&gt;&lt;/P&gt;
&lt;P align=left&gt;&lt;FONT size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //**** SYNC OPERATIONS&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //******************************&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;[&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;OperationContract&lt;/FONT&gt;&lt;FONT size=2&gt;(IsOneWay = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;true&lt;/FONT&gt;&lt;FONT size=2&gt;)]&amp;nbsp; // Requests a list of message IDs&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; void&lt;/FONT&gt;&lt;FONT size=2&gt; MessageIDRequest();&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;[&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;OperationContract&lt;/FONT&gt;&lt;FONT size=2&gt;(IsOneWay = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;true&lt;/FONT&gt;&lt;FONT size=2&gt;)]&amp;nbsp; // Responds with a list of message IDs&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; void&lt;/FONT&gt;&lt;FONT size=2&gt; MessageIDReply(&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;List&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;Guid&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;gt; messageIDs);&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;[&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;OperationContract&lt;/FONT&gt;&lt;FONT size=2&gt;(IsOneWay = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;true&lt;/FONT&gt;&lt;FONT size=2&gt;)]&amp;nbsp; // Requests the messages corresponding to a list of IDs&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; void&lt;/FONT&gt;&lt;FONT size=2&gt; MessageContentRequest(&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;List&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;Guid&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;gt; messageIDs);&lt;/FONT&gt;&lt;/P&gt;
&lt;P align=left&gt;&lt;FONT size=2&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;[&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;OperationContract&lt;/FONT&gt;&lt;FONT size=2&gt;(IsOneWay = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;true&lt;/FONT&gt;&lt;FONT size=2&gt;)]&amp;nbsp; // Responds with a list of messages&amp;nbsp;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; void&lt;/FONT&gt;&lt;FONT size=2&gt; MessageContentReply(&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;List&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;ChatMessage&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;gt; messages);&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;5. &lt;STRONG&gt;When to run synchronization:&lt;/STRONG&gt; In this simple example, we will assume that no messages are dropped when a node is fully connected to the mesh.&amp;nbsp;&amp;nbsp;However, we will still run synchronization every time a node joins the mesh.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Next, let's go over the implementation of the sync functions.&amp;nbsp; We are introducing a new enumeraion, SyncStatus, to indicate the state of the syncing node.&amp;nbsp; This allows the node to ignore or process the appropriate messages in the process.&amp;nbsp; We add this enumeration as&amp;nbsp;a local member variable named&amp;nbsp;&lt;EM&gt;synching&lt;/EM&gt;, to our node implementation.&lt;/P&gt;
&lt;P&gt;public&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;enum&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;SyncStatus&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; NotSynching,&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; IDRequest,&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ContentRequest&lt;BR&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;The following functions are being added to ChatApp, our implementation of IChat.&amp;nbsp; Remember also that the following functions will be executed when the node RECEIVES the given message.&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#0000ff size=2&gt;public&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; MessageIDRequest()&lt;BR&gt;{&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if&lt;/FONT&gt;&lt;FONT size=2&gt; (&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;this&lt;/FONT&gt;&lt;FONT size=2&gt;.synching == &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;SyncStatus&lt;/FONT&gt;&lt;FONT size=2&gt;.NotSynching)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;List&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;Guid&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;gt; requestIDs = &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=#008080 size=2&gt;List&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;Guid&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;gt;(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;this&lt;/FONT&gt;&lt;FONT size=2&gt;.chatLog.Keys);&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this&lt;/FONT&gt;&lt;FONT size=2&gt;.participant.MessageIDReply(requestIDs);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;}&lt;/P&gt;&lt;/FONT&gt;
&lt;P mce_keep="true"&gt;Here, we first ensure that we are not current syncing (and therefore have a complete data set).&amp;nbsp; The non-syncing node then create a list of message IDs created from its local data store, chatLog (a Dictionary structure), and sends it back to the mesh.&lt;/P&gt;&lt;FONT size=2&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;public&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; MessageIDReply(&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;List&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;Guid&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;gt; messageIDs)&lt;BR&gt;{&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if&lt;/FONT&gt;&lt;FONT size=2&gt; (&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;this&lt;/FONT&gt;&lt;FONT size=2&gt;.synching == &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;SyncStatus&lt;/FONT&gt;&lt;FONT size=2&gt;.IDRequest)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;this&lt;/FONT&gt;&lt;FONT size=2&gt;.synching = &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;SyncStatus&lt;/FONT&gt;&lt;FONT size=2&gt;.ContentRequest;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; List&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;Guid&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;gt; responseIDs = &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=#008080 size=2&gt;List&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;Guid&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;gt;();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;foreach&lt;/FONT&gt;&lt;FONT size=2&gt; (&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;Guid&lt;/FONT&gt;&lt;FONT size=2&gt; id &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;in&lt;/FONT&gt;&lt;FONT size=2&gt; messageIDs)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;if&lt;/FONT&gt;&lt;FONT size=2&gt; (!&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;this&lt;/FONT&gt;&lt;FONT size=2&gt;.chatLog.ContainsKey(id))&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT size=2&gt;responseIDs.Add(id);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;if&lt;/FONT&gt;&lt;FONT size=2&gt; (responseIDs.Count != 0)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT size=2&gt;{&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;this&lt;/FONT&gt;&lt;FONT size=2&gt;.participant.MessageContentRequest(responseIDs);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;this.synching = SyncStatus.NotSynching;&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;FONT size=2&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;}&lt;/P&gt;&lt;/FONT&gt;
&lt;P align=left mce_keep="true"&gt;In this function, the syncing node receives a list of message IDs from a neighbor.&amp;nbsp; It checks its local data store against each message in the list and generates a list of messages missing from its local data store.&amp;nbsp; If no messages are missing, syncing is done.&amp;nbsp; Otherwise, it sends a list of message IDs to its neighbors, requesting the content of those messages.&amp;nbsp;&amp;nbsp;If the node knows the&amp;nbsp;member IDs of its&amp;nbsp;neighbors, it could split up the list between them and send each a unique content request.&amp;nbsp;&amp;nbsp;As&amp;nbsp;a computer science professor&amp;nbsp;would say, "that is left as an excercise for the interested student."&lt;/P&gt;
&lt;P align=left mce_keep="true"&gt;&lt;FONT color=#0000ff size=2&gt;public&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; MessageContentRequest(&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;List&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;Guid&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;gt; messageIDs)&lt;BR&gt;{&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if&lt;/FONT&gt;&lt;FONT size=2&gt; (&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;this&lt;/FONT&gt;&lt;FONT size=2&gt;.synching == &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;SyncStatus&lt;/FONT&gt;&lt;FONT size=2&gt;.NotSynching)&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; List&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;ChatMessage&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;gt; responseContent = &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=#008080 size=2&gt;List&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;ChatMessage&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;gt;();&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach&lt;/FONT&gt;&lt;FONT size=2&gt; (&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;Guid&lt;/FONT&gt;&lt;FONT size=2&gt; id &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;in&lt;/FONT&gt;&lt;FONT size=2&gt; messageIDs)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT size=2&gt;responseContent.Add(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;this&lt;/FONT&gt;&lt;FONT size=2&gt;.chatLog[id]);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;if&lt;/FONT&gt;&lt;FONT size=2&gt; (responseContent.Count != 0)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT size=2&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;this&lt;/FONT&gt;&lt;FONT size=2&gt;.participant.MessageContentReply(responseContent);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&lt;/FONT&gt;}&lt;/P&gt;
&lt;P&gt;Upon receiving the message content request, a non-syncing node creates a list of chat messages corresponding to the message IDs in the list contained in the MessageContentRequest, and sends back the messages to the syncing node.&lt;/P&gt;&lt;FONT size=2&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;public&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; MessageContentReply(&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;List&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;ChatMessage&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;gt; messages)&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;if&lt;/FONT&gt;&lt;FONT size=2&gt; (&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;this&lt;/FONT&gt;&lt;FONT size=2&gt;.synching == &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;SyncStatus&lt;/FONT&gt;&lt;FONT size=2&gt;.ContentRequest)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;foreach&lt;/FONT&gt;&lt;FONT size=2&gt; (&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;ChatMessage&lt;/FONT&gt;&lt;FONT size=2&gt; msg &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;in&lt;/FONT&gt;&lt;FONT size=2&gt; messages)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT size=2&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;this&lt;/FONT&gt;&lt;FONT size=2&gt;.chatLog.Add(msg.msgId, msg);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;this&lt;/FONT&gt;&lt;FONT size=2&gt;.synching = &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;SyncStatus&lt;/FONT&gt;&lt;FONT size=2&gt;.NotSynching;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT size=2&gt;}&lt;BR&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Finally, once the syncing node receives the messages, it adds the messages to its local data store.&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;Now, all we have left to do with our chat sample is add the following local class varibles to ChatApp:&lt;/FONT&gt;&lt;/P&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;Dictionary&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;Guid&lt;/FONT&gt;&lt;FONT size=2&gt;, &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;ChatMessage&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;gt; chatLog;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;SyncStatus&lt;/FONT&gt;&lt;FONT size=2&gt; synching;&lt;/P&gt;&lt;/FONT&gt;
&lt;P&gt;&lt;FONT size=2&gt;We will also have a new constructor:&lt;/FONT&gt;&lt;/P&gt;&lt;FONT size=2&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;public&lt;/FONT&gt;&lt;FONT size=2&gt; ChatApp(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;string&lt;/FONT&gt;&lt;FONT size=2&gt; member)&lt;BR&gt;{&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; this&lt;/FONT&gt;&lt;FONT size=2&gt;.member = member;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; this&lt;/FONT&gt;&lt;FONT size=2&gt;.chatLog = &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=#008080 size=2&gt;Dictionary&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;Guid&lt;/FONT&gt;&lt;FONT size=2&gt;, &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;ChatMessage&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;gt;();&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; this&lt;/FONT&gt;&lt;FONT size=2&gt;.synching = &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;SyncStatus&lt;/FONT&gt;&lt;FONT size=2&gt;.NotSynching;&lt;BR&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;FONT size=2&gt;
&lt;P&gt;We also need to log each chat message now.&amp;nbsp; The Chat function in ChatApp will need to the following line of code:&lt;/P&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;this&lt;/FONT&gt;&lt;FONT size=2&gt;.chatLog.Add(msg.msgId, msg);&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;And finally, the node will need to perform the following upon entering the mesh (after calling Join):&lt;/FONT&gt;&lt;/P&gt;&lt;FONT size=2&gt;
&lt;P&gt;instance.synching = &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;SyncStatus&lt;/FONT&gt;&lt;FONT size=2&gt;.IDRequest;&lt;BR&gt;instance.participant.MessageIDRequest();&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;At this point, we now have a chat app that contains a synchronized chat log!&amp;nbsp; Displaying&amp;nbsp;the contents of the chat log can be accomplished by enumerating and printing out to the console the content of the ChatLog variable.&amp;nbsp; For example, if "instance" is the name of our ChatApp instance:&lt;/FONT&gt;&lt;/P&gt;&lt;FONT size=2&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;ICollection&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;ChatMessage&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;gt; messages = instance.chatLog.Values;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;foreach&lt;/FONT&gt;&lt;FONT size=2&gt; (&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;ChatMessage&lt;/FONT&gt;&lt;FONT size=2&gt; message &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;in&lt;/FONT&gt;&lt;FONT size=2&gt; messages)&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;Console&lt;/FONT&gt;&lt;FONT size=2&gt;.WriteLine(&lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"=&amp;gt; ["&lt;/FONT&gt;&lt;FONT size=2&gt; + message.msgSource + "] " +&amp;nbsp;message.msgTxt);&lt;BR&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;And there you have it!&amp;nbsp; With relatively minor changes, our chat application now contains some basic synchronization, useful for those who come late to the chat room and want to catch up on what they missed.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Extra Credit: Ordering Synchronized Messages &lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;In many applications such as chat, it is vital that the order in which messages are created is maintained.&amp;nbsp; Our example neglects this need in exchange for simplicity.&amp;nbsp; However, a real production chat application would definitely need to address this issue.&amp;nbsp; There are a few complications with this, since messages may arrive in different orders to different nodes, so syncing to different nodes will result in different results.&amp;nbsp; For example, if two nodes on either end of a large mesh send a message, nodes in between may differ as to which message arrives first.&amp;nbsp; Here are&amp;nbsp;a couple potential options that we will leave up to you to implement: &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;- Add timestamps member to each message and attach the current system time to each message before sending.&amp;nbsp; When displaying a message log, the messages can be sorted by timestamp.&amp;nbsp; The difficulty of this approach is that all machines may not be time synchronized, and so inconsistencies may still result.&lt;/P&gt;
&lt;P&gt;- Assign a single member of the mesh to determine the definitive ordering of messages.&amp;nbsp; Naturally, this will make things especially difficult if that member goes down, but has the advantage of creating a single, unified ordering across the entire mesh.&lt;/P&gt;
&lt;P&gt;- Add to each message the ID of the message that immediately preceeded it.&amp;nbsp; The data store can then link messages together in a&amp;nbsp;hierarchal tree in case two messages arrive with the same previous ID&amp;nbsp;attached.&amp;nbsp; This&amp;nbsp;has the advantage of maintaining order while keeping track of ambiguities, but nevertheless does not resolve the&amp;nbsp;problem.&lt;/P&gt;
&lt;P&gt;Best of luck in implmenting your synchronization!&amp;nbsp; -Jonathan&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=4657762" width="1" height="1"&gt;</description></item><item><title>PeerChannel and Synchronization</title><link>http://blogs.msdn.com/peerchan/archive/2007/08/30/peerchannel-and-synchronization.aspx</link><pubDate>Thu, 30 Aug 2007 22:38:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4656643</guid><dc:creator>peerchan</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/peerchan/comments/4656643.aspx</comments><wfw:commentRss>http://blogs.msdn.com/peerchan/commentrss.aspx?PostID=4656643</wfw:commentRss><description>&lt;P&gt;One of our most popular questions has centered around using synchronization with PeerChannel.&amp;nbsp; Although PeerChannel does not include a synchronization layer in box, it is not overly difficult to develop your own synchronization layer on top.&amp;nbsp; Although a complete discussion on distributed synchronization protocols is beyond the scope of a single blog article, I will try to outline some tips and guidance on how a developer might go about adding this component to their PeerChannel-based application.&amp;nbsp; Since PeerChannel already takes care of distributing messages to the entire mesh, synchronization can be summed up in two parts:&lt;/P&gt;
&lt;P&gt;A) Ensure that all messages are delivered (i.e. resending dropped messages,&amp;nbsp;a reliability layer)&lt;/P&gt;
&lt;P&gt;B) Populating nodes with data when they enter/re-enter the mesh.&lt;/P&gt;
&lt;P align=left&gt;Although&amp;nbsp;both parts are essential to ensure good synchronization, the first part alone is sufficient for most purposes.&amp;nbsp; (Also, adding a reliability layer to PeerChannel is another topic in&amp;nbsp;and of itself.)&amp;nbsp; Therefore, we will concentrate on the second part.&amp;nbsp;&amp;nbsp;Here are some basic steps&amp;nbsp;to create your own synchronization layer in PeerChannel:&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;1. Determine the set of data you want to synchronize.&lt;/STRONG&gt;&amp;nbsp; You might want to only synchronize the last 5 minutes of data, or your application might want to synchronize a very large data over a long amount of time.&amp;nbsp; The size and type of this data set will most likely determine whether or not you want each node to have a complete copy of the data, as well as whether or not&amp;nbsp;a centralized solution might be a little more appropriate.&amp;nbsp; (Example: If the data you want to synchronize is several GBs, you'll either want to split that up over many, many nodes, OR have a complete copy of the data set&amp;nbsp;residing on&amp;nbsp;a server).&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;2. Decide on how each node will store the data you wish to synchronize.&amp;nbsp; &lt;/STRONG&gt;One way might be to store data records as entries in a Dictionary structure.&amp;nbsp; The key for each entry in the Dictionary will be a unique ID given to each data record when it sent over the mesh.&amp;nbsp;&amp;nbsp;If the ordering of messages is important, you can use a List structure to organize records, or add ordering to the hash table. (By including a Next field in each record containing the key of the next record, you can walk through all the records in a dictionary in order.)&lt;/P&gt;
&lt;P align=left&gt;&lt;STRONG&gt;3. Decide on a synchronization protocol.&amp;nbsp; &lt;/STRONG&gt;Once again, the specifc protocol you choose will vary depending on your application.&amp;nbsp;&amp;nbsp;The simple,&amp;nbsp;naive&amp;nbsp;protocol could have just three steps (assumes that all nodes have the complete data set):&lt;/P&gt;
&lt;P align=left&gt;I) The node sends a sync request to its immediate neighbors (SyncRequest)&lt;BR&gt;II) The neighbors send a response containing a complete list of data&amp;nbsp;(SyncResponse)&lt;BR&gt;III) The syncing node receives the sync responses and adds the records to its local data store.&lt;/P&gt;
&lt;P align=left&gt;&lt;EM&gt;Note:&amp;nbsp;Sending a message to&amp;nbsp;a node's immediate neighbors may be accomplished by&amp;nbsp;using the HopCount attribute.&amp;nbsp; For more information on how to use the HopCount attribute, please refer to&amp;nbsp;an earlier entry in this&amp;nbsp;blog.&lt;/EM&gt;&amp;nbsp;&lt;/P&gt;
&lt;P align=left&gt;Most pull-based sync protocols (where the node explicitly requests a sync), generally follow this format to some degree.&amp;nbsp; This particular approach, however, would probably be too inefficient, since all of the node's neighbors will be sending the complete data set.&amp;nbsp; Since a PeerChannel node should have 3 neighbors at all times, that amounts to sending the entire data set 3 times&amp;nbsp;over the network.&amp;nbsp; In addition, the syncing node may already have a part of the data set in the first place, so sending the complete data set would be unnecessary.&amp;nbsp; &lt;/P&gt;
&lt;P align=left&gt;&lt;STRONG&gt;4. Add your synchronization protocol messages to your message contract &lt;/STRONG&gt;-&amp;nbsp;The simplest way to add your sync messages will be to add them to the contract you are already using to send your application messages over the mesh.&amp;nbsp; You can separate them into their own contract if you like, although this may complicate your code.&lt;/P&gt;
&lt;P align=left&gt;&amp;nbsp;&lt;STRONG&gt;5. Decide when to run synchronization.&lt;/STRONG&gt; Unless you write your own reliability layer onto PeerChannel, nodes in the mesh will need to periodically run your synchronization protocol, even if they have never left the mesh.&amp;nbsp; This will compensate for the small chance that messages are dropped in the mesh (since PeerChannel doe not offer any reliability guarantees).&amp;nbsp; We have already pointed out that certain sync protocols can be inefficeint with bandwidth, so running synchronization too often can be problematic.&amp;nbsp;However, if synchronization is not run often enough, inconsistency between data sets can persist longer than desired.&amp;nbsp; The exact time interval will need to balance both.&amp;nbsp; And finally, you will need to run synchronization every time a node enters or re-enters the mesh.&lt;/P&gt;
&lt;P align=left&gt;At this point, all that is left to do is to implement your sync primitives, add sync calls into your main code, and you're done!&amp;nbsp; Our next entry will walk through modifying the PeerChat example to use synchronization.&amp;nbsp;&amp;nbsp;-Jonathan.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=4656643" width="1" height="1"&gt;</description></item><item><title>Custom Resolver FAQ: Registration Lifetimes and Refresh </title><link>http://blogs.msdn.com/peerchan/archive/2007/06/30/custom-resolver-faq-registration-lifetimes-and-refresh.aspx</link><pubDate>Sun, 01 Jul 2007 08:02:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3637660</guid><dc:creator>peerchan</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/peerchan/comments/3637660.aspx</comments><wfw:commentRss>http://blogs.msdn.com/peerchan/commentrss.aspx?PostID=3637660</wfw:commentRss><description>&lt;P&gt;As PeerChannel and the .NET Framework continue to gain traction and popularity, we are starting to receive a number of questions about how to use various parts of this exciting technology.&amp;nbsp; Some of our most common questions center around the use of the Custom Resolver Service.&amp;nbsp;&amp;nbsp;Note that a discussion of whether or not to&amp;nbsp;implement a Custom Resolver will be in a upcoming blog entry - we will assume for&amp;nbsp;now that your particular scenario requires&amp;nbsp;the use of a Custom Resolver (for example, if your application&amp;nbsp;runs on Windows Server 2003).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Here are the two main questions I will be answering in this entry:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) What are Registration Lifetimes?&amp;nbsp; What are they used for?&amp;nbsp; &lt;/P&gt;
&lt;P&gt;2) What is the purpose of the Refresh operation?&amp;nbsp; When do I call it?&lt;/P&gt;
&lt;P&gt;So let's start with the basics and tackle these questions.&amp;nbsp; A reminder that when we refer to a &lt;STRONG&gt;node&lt;/STRONG&gt;, we are talking about a single application endpoint and a &lt;STRONG&gt;mesh &lt;/STRONG&gt;refers to a connected groups of nodes.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Registration Record&lt;/STRONG&gt;:&amp;nbsp;Each node in the mesh publishes their endpoint information to the resolver service through the Register operation.&amp;nbsp; The resolver service stores this information as a registration record.&amp;nbsp; This registration record contains a unique identifier (RegistrationID), endpoint information (PeerNodeAddress), and expiration time (DateTime).&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Why An Expiration Time?&lt;/STRONG&gt;&amp;nbsp; Ideally, when each node leaves the mesh, it will call the Unregister operation, which will cause the resolver service to remove the registration entry.&amp;nbsp; However, it may not be unusal for a node to shut down or become inaccessible before calling Unregister. (For example, the node may be connectly wirelessly and go out of range).&amp;nbsp; In this case, the resolver service needs some way of being able to purge stale and invalid registration records.&amp;nbsp; Having an expiration time for each registration record allows the resolver service to indentify these stale records and remove them to keep the registration records clean.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Why Do I Care About Stale Records?&amp;nbsp; &lt;/STRONG&gt;There are two reasons why having stale registration records at your resolver service is a bad idea.&amp;nbsp; First, stale records may result in unnessary failed connections.&amp;nbsp; If&amp;nbsp;a node trying to connect to a mesh receives stale&amp;nbsp;connection information from the resolver service, it will take longer, sometimes MUCH longer&amp;nbsp;to connect to the mesh.&amp;nbsp;&amp;nbsp;But it doesn't end there.&amp;nbsp; The second reason why stale records are bad is that they take up memory.&amp;nbsp; Since registrationIDs are typically generated every time a node is created or recreated, it is possible for a node entering and leaving the mesh multiple times to leave several stale registration records.&amp;nbsp; Without an efficient process to remove registrations records, it is inevitable that eventually that the size of the cache used to store registration data will overflow and crash your resolver service.&amp;nbsp; So removing these records is important.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;When Do I Remove Stale Records?&amp;nbsp; &lt;/STRONG&gt;The default implementation of CustomResolverService class has the &lt;STRONG&gt;CleanupInterval&lt;/STRONG&gt; property.&amp;nbsp; This property (a TimeSpan object) tells the resolver service to go through and delete stale records every time &lt;STRONG&gt;CleanupInterval&lt;/STRONG&gt; passes.&amp;nbsp; This should be set to a time equal or greater than the &lt;STRONG&gt;RefreshInterval &lt;/STRONG&gt;set on the service (more on that later).&amp;nbsp; If you are using the default implementation of the custom resolver service, all you need to do is set this property and you're good to go.&amp;nbsp; Otherwise, if you are implementing your own resolver service, you have a couple choices:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1) Periodic maintenance:&amp;nbsp; Do what we did!&amp;nbsp; Set a timer to go off every so often and go through your data store to delete old records.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2) Passive Deletion:&amp;nbsp; Instead of actively hunting for stale records at intervals, you may want to delete records when your service is already performing another function.&amp;nbsp; This may potentially slow down response time to requests from the resolver clients, but it has the benefits of doing away with a timer and may be more efficient if you don't expect many nodes to leave ungracefully.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;How Do I Make Sure Good Records Don't Get Deleted?&amp;nbsp; &lt;/STRONG&gt;This is the purpose of the &lt;STRONG&gt;Refresh&lt;/STRONG&gt; operation.&amp;nbsp; Nodes publishing information at the resolver service need to call Refresh periodically to ensure that the expiration time on their records is extended.&amp;nbsp; When the resolver service receives a Refresh request, it should look up the record and extend the expiration time.&amp;nbsp; As long as the expiration time stays in the future,&amp;nbsp;the resolver service will not delete the record.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;How Do I Know When To Call Refresh?&amp;nbsp; &lt;/STRONG&gt;The RegisterResponseInfo and&amp;nbsp;RefreshResponseInfo objects are sent back to the node&amp;nbsp;in response to a Refresh and&amp;nbsp;Register operations, as well as Update (the response to a Update is the same as the response to a Register).&amp;nbsp; These objects contain a TimeSpan property called &lt;STRONG&gt;RegistrationLifetime&lt;/STRONG&gt;, which indicates to the node how much time it has before it needs to call Refresh.&amp;nbsp; So if the resolver service responds to a node's Register request with a RegistrationLifetime of 2 minutes, that node needs to call Refresh in under 2 minutes to ensure that the record stays fresh.&amp;nbsp; Of course, the node should keep in mind that there may be a small amount of latency between the node and the resolver service, so it may be a good idea to send a Refresh a tad under the time given by the RegistrationLifetime.&amp;nbsp; Naturally, the resolver service is not forced to delete a registration record the instant it goes stale (this would not scale well), but it must guarantee that registration records are held for the time given by RegistrationLifetime.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Summary:&lt;BR&gt;- &lt;/STRONG&gt;Registration records shouldn't last forever - let the default implementation delete them for you, or write your own maintenance function&lt;BR&gt;- To identify stale records, the default implementation marks each record with an expiration time.&amp;nbsp; Custom implementation should do something similar&lt;BR&gt;- In order to avoid having a registration record deleted, a node must call Refresh before the registration record's expiration time.&lt;BR&gt;- The RegistrationLifetime value, sent by the resolver service, tells a node how much time it has to call Refresh before the registration record expires.&lt;/P&gt;
&lt;P&gt;And there you have it!&amp;nbsp; Please comment below or contact us if you have any questions about this or any other Custom Resolver Service feature. -Jonathan&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3637660" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/peerchan/archive/tags/Discovery+_2800_Name+Resolution_2900_/default.aspx">Discovery (Name Resolution)</category></item><item><title>Extending the CustomPeerResolverService: LinearResolverService.cs</title><link>http://blogs.msdn.com/peerchan/archive/2007/06/20/extending-the-defaultpeercustomresolver.aspx</link><pubDate>Wed, 20 Jun 2007 16:40:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3424749</guid><dc:creator>peerchan</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/peerchan/comments/3424749.aspx</comments><wfw:commentRss>http://blogs.msdn.com/peerchan/commentrss.aspx?PostID=3424749</wfw:commentRss><description>&lt;P&gt;For&amp;nbsp;background information on PeerChannel discovery mechanisms and options please refer to &lt;A href="http://msdn2.microsoft.com/en-us/library/aa702771.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/aa702771.aspx"&gt;http://msdn2.microsoft.com/en-us/library/aa702771.aspx&lt;/A&gt;. &lt;/P&gt;
&lt;P&gt;By default, PeerChannel uses the Windows Peer Name Resolution Protocol (PNRP) for discovery of peers and neighbors in the mesh. But we also provide an alternative server-based out-of-the-box discovery service- the CustomPeerResolverService- for&amp;nbsp;situations/platforms&amp;nbsp;where PNRP is not available or feasible. This post talks&amp;nbsp;about how to go about extending default implementation of the custom resolver, for greater control over mesh shaping and discovery. &lt;/P&gt;
&lt;P&gt;In general, when a Peer node first starts up, it tries to look up new neighbors by invoking the CustomPeerResolverService.Resolve() method before&amp;nbsp;going ahead and&amp;nbsp;registering itself with the resolver service.&amp;nbsp;To control the shape of your mesh, for example, all you would need is an extension to the resolver service which is similar to default implementation, except for custom Resolve(), Register(), Unregister() methods. In actual programming terms, it means that your customResolverSerivce class implementation would simply inherit from our base implementation and then have scenario-specific customizations and overrides.&lt;/P&gt;
&lt;P&gt;Sample User Scenario: I want to create a linear mesh (i.e. every node is connected to exactly one neighbor; the custom name resolver should therefore provide the new requesting node with referrals to only&amp;nbsp;the last node to register with it). &lt;/P&gt;
&lt;P&gt;Solution: Attached to the post is a simple extension to the default CustomPeerResolverService with overridden Resolve(), Register(), Unregister() methods. &lt;/P&gt;
&lt;P&gt;Configuring your PeerChannel client application to use your custom service: This can be done by configuring the instance of NetPeerTcpBinding in your application like so:&lt;FONT size=2&gt;&lt;FONT color=#008080 size=2&gt;&lt;FONT color=#008080 size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;&lt;FONT color=#008080 size=2&gt;&lt;FONT color=#000000&gt;&amp;lt;snip&amp;gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#008080 size=2&gt;NetPeerTcpBinding&lt;/FONT&gt;&lt;FONT size=2&gt; binding = &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=#008080 size=2&gt;NetPeerTcpBinding&lt;/FONT&gt;&lt;FONT size=2&gt;();&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;
&lt;P&gt;customResolverEpr = &lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"net.tcp://"&lt;/FONT&gt;&lt;FONT size=2&gt; + customResolverHostName + &lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;":"&lt;/FONT&gt;&lt;FONT size=2&gt; + CustomResolverServicePort.ToString() + &lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"/DefaultResolverService"&lt;/FONT&gt;&lt;FONT size=2&gt;;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT size=2&gt;
&lt;P&gt;binding.Resolver.Mode = &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;PeerResolverMode&lt;/FONT&gt;&lt;FONT size=2&gt;.Custom;&lt;/P&gt;
&lt;P&gt;binding.Resolver.Custom.Address = &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=#008080 size=2&gt;EndpointAddress&lt;/FONT&gt;&lt;FONT size=2&gt;(customResolverEpr);&lt;/P&gt;
&lt;P&gt;binding.Resolver.Custom.Binding = &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=#008080 size=2&gt;NetTcpBinding&lt;/FONT&gt;&lt;FONT size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;SecurityMode&lt;/FONT&gt;&lt;FONT size=2&gt;.None);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;&amp;lt;/snip&amp;gt;&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3424749" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/peerchan/attachment/3424749.ashx" length="5067" type="application/octet-stream" /><category domain="http://blogs.msdn.com/peerchan/archive/tags/Discovery+_2800_Name+Resolution_2900_/default.aspx">Discovery (Name Resolution)</category></item><item><title>Whats new in Orcas for PeerChannel : Manual addressing options.</title><link>http://blogs.msdn.com/peerchan/archive/2007/06/05/whats-new-in-orcas-for-peerchannel-manual-addressing-options.aspx</link><pubDate>Wed, 06 Jun 2007 03:21:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3106663</guid><dc:creator>peerchan</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/peerchan/comments/3106663.aspx</comments><wfw:commentRss>http://blogs.msdn.com/peerchan/commentrss.aspx?PostID=3106663</wfw:commentRss><description>&lt;P&gt;V1 of PeerChannel didnt have any support for manual addressing. In fact, the addressing headers are overwritten by the underlying TCP when the PeerChannel passed the message along to the transport. The way PeerChannel preserved the applications's addressing was by making copies and reapplying those to the message before delivering to the application's service runtime on the receiving end.&lt;/P&gt;
&lt;P&gt;Some interesting scenarios like Discovery needed a slightly different treatment of addressing headers from PeerChannel. One of the cool scenarios is to layer Discovery over PeerChannel with a CompositeDuplex, where the request is sent over PeerChannel in the outgoing binding, and the responses are handled by 1:1 conections in the incoming binding. pretty cool!&lt;/P&gt;
&lt;P&gt;To Support this end-to-end, PeerChannel needed to resurface the application's To header on the receiving side exactly as set by the sender. This To (which could be different from Via) is used by the Discovery layer to route the message to the appropriate application endpoint.&lt;/P&gt;
&lt;P&gt;Starting with Orcas, PeerChannel supports this kind of special manual-addressing like semantics. you can open a create host's endpoint with different To and Via values if your application needs this support. On the other hand, on the client side, you can attach a Via behavior (or use the appropriate variation that took To and Via) to open a proxy that stamped To and Via differently.&lt;/P&gt;
&lt;P&gt;For example, you could do the following on the client side, to set a different via:&lt;/P&gt;&lt;FONT size=2&gt;
&lt;BLOCKQUOTE&gt;&lt;/FONT&gt;&lt;EM&gt;&lt;FONT color=#008080 size=2&gt;&lt;FONT color=#008080 size=2&gt;
&lt;P&gt;EndpointAddress&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; epaTo = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;EndpointAddress&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;Uri&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT color=#000000&gt;(to1));&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;Program&lt;/FONT&gt;&lt;FONT size=2&gt; context = &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=#008080 size=2&gt;Program&lt;/FONT&gt;&lt;FONT size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"0"&lt;/FONT&gt;&lt;FONT size=2&gt;);&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;DuplexChannelFactory&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;ITestDuplexChannel&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;gt; cf = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;null&lt;/FONT&gt;&lt;FONT size=2&gt;;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;NetPeerTcpBinding&lt;/FONT&gt;&lt;FONT size=2&gt; binding = &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=#008080 size=2&gt;NetPeerTcpBinding&lt;/FONT&gt;&lt;FONT size=2&gt;();&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;cf = &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=#008080 size=2&gt;DuplexChannelFactory&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;ITestDuplexChannel&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;gt;(context, binding, epaTo);&lt;/P&gt;
&lt;P&gt;cf.Endpoint.Behaviors.Add(&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=#008080 size=2&gt;ClientViaBehavior&lt;/FONT&gt;&lt;FONT size=2&gt;(via));&lt;/P&gt;
&lt;P&gt;cf.Open();&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;On the service side,&amp;nbsp;you can add a PeerChannel service endpoint to a serivce host and set the ListenUri as follows:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;FONT size=2&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;EM&gt;&lt;FONT color=#008080 size=2&gt;ServiceHost&lt;/FONT&gt;&lt;FONT size=2&gt; host1 = &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=#008080 size=2&gt;ServiceHost&lt;/FONT&gt;&lt;FONT size=2&gt;(&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=#008080 size=2&gt;Program&lt;/FONT&gt;&lt;FONT size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"ServiceHost1"&lt;/FONT&gt;&lt;/EM&gt;&lt;FONT size=2&gt;&lt;EM&gt;));&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;EM&gt;&lt;FONT color=#008080 size=2&gt;ServiceEndpoint&lt;/FONT&gt;&lt;FONT size=2&gt; sep1 = host1.AddServiceEndpoint(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;typeof&lt;/FONT&gt;&lt;FONT size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;ITest&lt;/FONT&gt;&lt;/EM&gt;&lt;FONT size=2&gt;&lt;EM&gt;), binding, epaTo);&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;sep1.ListenUri = via;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;host1.Open();&lt;/EM&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This new behavior does not require flipping any switches or tweaking settings. It is available straight out-of-the-box.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3106663" width="1" height="1"&gt;</description></item><item><title>How many channels can a mesh handle?</title><link>http://blogs.msdn.com/peerchan/archive/2007/05/07/how-many-channels-can-a-mesh-handle.aspx</link><pubDate>Tue, 08 May 2007 02:35:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2471754</guid><dc:creator>peerchan</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/peerchan/comments/2471754.aspx</comments><wfw:commentRss>http://blogs.msdn.com/peerchan/commentrss.aspx?PostID=2471754</wfw:commentRss><description>&lt;P&gt;It is often asked how many different contracts can a mesh handle. How should one go about deciding howmany channels one can create in an application using the same mesh name. Brief answer is: there is no limit. It depends on the application design and traffic characteristics.&lt;/P&gt;
&lt;P&gt;PeerChannel allows creating multiple channels on the same mesh. This is useful when you have multiple contract types that you wish to use for mesh communication. A typical example is a multi media session : one can envision a multimedia application based on peerchannel that uses separate channels for sending audio, slides, video etc,... In this case, different calls to CreateChannel will pass different uris that all reference the same hostname. When the same hostname is used by multiple channel factories, they all use the same PeerNode instance as their transport. This causes the messages sent over different channels to be multiplexed at the peernode layer.&lt;/P&gt;
&lt;P&gt;Following factors can influence the design factoring:&lt;/P&gt;
&lt;P&gt;Security aspects of different channels. Its easy to decide if all of them have the same requirements. Otherwise, you have to consider factoring the contracts based on this need. Not all channels may need to be secured.&lt;/P&gt;
&lt;P&gt;One of the main factors influencing the design is the relative bandwidth requirements of various channels. If there is a channel that needs bigger message size and exchanges messages more frequently than others, then you probably dont want to penalize the quy who is only interested in a small chunk of messages by sending him everything and asking him to forward everything. Remember that in a mesh, everyone receives every message and forwards them on unless restricted by hopcount.&lt;/P&gt;
&lt;P&gt;Number of such contracts. It is not a good idea at the same time to make every contract a different mesh. This will bloat up the process with lot of peernodes each trying to build their connections, eating up resources for no good reason.&lt;/P&gt;
&lt;P&gt;Consider the overhead of having a peernode:&lt;/P&gt;
&lt;P&gt;A peernode consists of the following key parts:&lt;/P&gt;
&lt;P&gt;A) PeerNode itself : holds most of the configuration. acts as a container of other key pieces of peer node like, flooder, maintainer, service endpoint etc,... Has no processing overhead by itself - Acts as the public face of the node by turning key events into Offline and Online events.&lt;/P&gt;
&lt;P&gt;B) Flooder: this is the part that is responsible for forwarding and delivering messages. A duplicate message is dropped by the Flooder. It also has to maintain certain amount of state about each incoming message, to avoid duplicates and replay attacks. It keeps a cache of message id for each message. This cache is cycle - a message id lives for atmost 5 minutes. A messageId is 16byes (unsecured) or 256bytes in case of authenticated messages. If you are receiving messages at the rate of 500 unsecure messages per sec, then your cache contains rougly 2MB of working size per node. On the other hand, if you are receiving 200 authenticated messages per second, your cache can grow to as much as 15MB.&lt;/P&gt;
&lt;P&gt;C) Maintenance: PeerNode has a periodic maintenance component to it. Every minute (or every 32 messages it received), it sends back an ack to its neighbors that contains some key stats : how many messages are exchanged. howmany are useful (non-duplicates, untampered). Every 5 minutes or so (often if you dont have enough connections),the maintainer wakes up and checks the health of neighbor connections - if it has more connections than ideal, it prunes off the less useful of them. If you are less than ideal, it acquires more connections.&lt;/P&gt;
&lt;P&gt;D) Service endpoint: This is the component responsible for keeping connections with other peers in the mesh. Main state of this component is the tcp listener and peer proxy connections.&lt;/P&gt;
&lt;P&gt;E) Resolver service. Mesh factoring is also influenced by the resolver being used. if you are using PNRP, remember that for each mesh you create, a separate PNRP registration (in each cloud) is made on your behalf. Each registered name probably involves one or more network roundtrips as part of its maintenance. If you are using the custom resolver, your traffic and resource overhead is multiplied by the number of meshes you create. as many registrations, resolves, refresh etc,...&lt;/P&gt;
&lt;P&gt;Hope this information is useful when factoring the contracts into service endpoints.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2471754" width="1" height="1"&gt;</description></item><item><title>How/where to get the Peer channel samples?</title><link>http://blogs.msdn.com/peerchan/archive/2007/01/15/peer-channel-samples-in-the-windows-sdk.aspx</link><pubDate>Mon, 15 Jan 2007 23:33:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1472828</guid><dc:creator>peerchan</dc:creator><slash:comments>6</slash:comments><comments>http://blogs.msdn.com/peerchan/comments/1472828.aspx</comments><wfw:commentRss>http://blogs.msdn.com/peerchan/commentrss.aspx?PostID=1472828</wfw:commentRss><description>&lt;P&gt;We ship a total of 6 samples with the Windows SDK, that are included in the WindowsCommunicationFoundation samples zipped file. &lt;/P&gt;
&lt;P&gt;Download locations: &lt;/P&gt;
&lt;P&gt;1. RTM Runtime: &lt;A href="http://www.microsoft.com/downloads/details.aspx?FamilyId=10CC340B-F857-4A14-83F5-25634C3BF043&amp;amp;displaylang=en" mce_href="http://www.microsoft.com/downloads/details.aspx?FamilyId=10CC340B-F857-4A14-83F5-25634C3BF043&amp;amp;displaylang=en"&gt;http://www.microsoft.com/downloads/details.aspx?FamilyId=10CC340B-F857-4A14-83F5-25634C3BF043&amp;amp;displaylang=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;2. RTM Windows SDK: &lt;A href="http://www.microsoft.com/downloads/details.aspx?FamilyId=C2B1E300-F358-4523-B479-F53D234CDCCF&amp;amp;displaylang=en" mce_href="http://www.microsoft.com/downloads/details.aspx?FamilyId=C2B1E300-F358-4523-B479-F53D234CDCCF&amp;amp;displaylang=en"&gt;http://www.microsoft.com/downloads/details.aspx?FamilyId=C2B1E300-F358-4523-B479-F53D234CDCCF&amp;amp;displaylang=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;On MSDN:&lt;/P&gt;
&lt;P&gt;1. Sample documentation for WCF: &lt;A href="http://msdn2.microsoft.com/en-us/library/ms735119.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/ms735119.aspx"&gt;http://msdn2.microsoft.com/en-us/library/ms735119.aspx&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;2. Peer channel sample +&amp;nbsp;documentation on msdn: &lt;/P&gt;
&lt;P&gt;The entire list of samples maybe found here: &lt;A href="http://msdn2.microsoft.com/en-us/library/ms752266.aspx"&gt;http://msdn2.microsoft.com/en-us/library/ms752266.aspx&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Shortcut links to hte individual samples themselves is as under:&lt;/P&gt;
&lt;P&gt;(a) Basic Binding samples - Use the Pnrp resolver mode- &lt;A href="http://msdn2.microsoft.com/en-us/library/ms735119.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/ms735119.aspx"&gt;http://msdn2.microsoft.com/en-us/library/ms735119.aspx&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; b) Scenario sample - &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (i) Chat - Demonstrates Chat using the non-PNRP custom resolver - &lt;A href="http://msdn2.microsoft.com/en-us/library/ms751502.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/ms751502.aspx"&gt;http://msdn2.microsoft.com/en-us/library/ms751502.aspx&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (ii) Custom Resolver (Advanced&amp;nbsp;users)&amp;nbsp;- Demonstrates how to write your own Custom Resolver service and client (instead of using the Pnrp&amp;nbsp;resolver OR&amp;nbsp;the&amp;nbsp;non-Pnrp default resolver service/client that&amp;nbsp;we ship with already).&amp;nbsp;- &lt;A href="http://msdn2.microsoft.com/en-us/library/ms751466.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/ms751466.aspx"&gt;http://msdn2.microsoft.com/en-us/library/ms751466.aspx&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Enjoy!&lt;/P&gt;
&lt;P&gt;-Shalini. &lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1472828" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/peerchan/archive/tags/Updates_2F00_News/default.aspx">Updates/News</category></item><item><title>Note for Windows XP users: Pnrp v2 upgrade location</title><link>http://blogs.msdn.com/peerchan/archive/2007/01/08/note-for-windows-xp-users-pnrp-v2-upgrade-location.aspx</link><pubDate>Tue, 09 Jan 2007 00:44:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1435791</guid><dc:creator>peerchan</dc:creator><slash:comments>5</slash:comments><comments>http://blogs.msdn.com/peerchan/comments/1435791.aspx</comments><wfw:commentRss>http://blogs.msdn.com/peerchan/commentrss.aspx?PostID=1435791</wfw:commentRss><description>&lt;P&gt;PNRP resolver-based applications running on XPSP2 with the P2P networking pack installed are running&amp;nbsp; v1 of the PNRP protocol. It is advisable to upgrade to PNRP v2 which can be downloaded as an XP update from &lt;A href="http://support.microsoft.com/default.aspx/kb/920342"&gt;http://support.microsoft.com/default.aspx/kb/920342&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Significance for Peer channel applications:&lt;/P&gt;
&lt;P&gt;- The main advantage of this upgrade is that your apps are interoperable between Windows Vista and XPSP2&lt;/P&gt;
&lt;P&gt;-Shalini.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1435791" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/peerchan/archive/tags/Updates_2F00_News/default.aspx">Updates/News</category></item><item><title>Tip: Automatically deploying P2P (PNRP) components on XPSP2</title><link>http://blogs.msdn.com/peerchan/archive/2007/01/03/automatically-deploying-p2p-pnrp-components-on-xpsp2.aspx</link><pubDate>Thu, 04 Jan 2007 02:58:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1411896</guid><dc:creator>peerchan</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/peerchan/comments/1411896.aspx</comments><wfw:commentRss>http://blogs.msdn.com/peerchan/commentrss.aspx?PostID=1411896</wfw:commentRss><description>&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Scenario&lt;/U&gt;:&lt;/STRONG&gt; Setting up PNRP/P2P Networking components on XPSP2&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Tip:&lt;/U&gt;&lt;/STRONG&gt; &lt;/P&gt;
&lt;P&gt;There is a command line option of installing windows components that we sometimes use (Please note that this is a general way of installing windows components by command line and is not exclusive to the P2P components- I would strongly advise you to test this first before using the solution in a commercial&amp;nbsp;application deployment solution- it works fine for some of our automated tests so as far as I know it works well): &lt;/P&gt;
&lt;P&gt;&lt;EM&gt;1. Save the following&amp;nbsp;text as a .txt file locally&amp;nbsp;to&amp;nbsp;&amp;nbsp;%SystemDrive%&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;[Components]&lt;BR&gt;Netoc=on&lt;BR&gt;[NetOptionalComponents]&lt;BR&gt;P2P=1&lt;BR&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;2.&amp;nbsp; Run the following command to install IPv6 on the machine (required for P2P):&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;netsh int ipv6 install&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;3. Now execute the following command to install the P2P Networking Pack:&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;%systemroot%\system32\Sysocmgr.exe /i:%systemroot%\inf\sysoc.inf /u:%SystemDrive%\EnablePnrpOnXPSP2.txt /q /w&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;This is the best&amp;nbsp;I have so far as automated deployment of the Advanced Networking pack (aka P2P pack) is concerned on Windows XP.&amp;nbsp; &lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;I haven't tried it myself, but I am guessing this could be integrated into the Setup package as well. &lt;/P&gt;
&lt;P&gt;Note: Feel free to&amp;nbsp;share your&amp;nbsp;feedback and&amp;nbsp;whether&amp;nbsp;you are able to get this to work for&amp;nbsp;your application deployment.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;-Shalini&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1411896" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/peerchan/archive/tags/Random+Peer+Channel+Tips/default.aspx">Random Peer Channel Tips</category></item><item><title>Happy New Year with WCF RTM</title><link>http://blogs.msdn.com/peerchan/archive/2007/01/02/happy-new-year-with-wcf-rtm.aspx</link><pubDate>Wed, 03 Jan 2007 06:24:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1401488</guid><dc:creator>peerchan</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/peerchan/comments/1401488.aspx</comments><wfw:commentRss>http://blogs.msdn.com/peerchan/commentrss.aspx?PostID=1401488</wfw:commentRss><description>&lt;P&gt;Hi, &lt;/P&gt;
&lt;P&gt;This is old news now, but the Peer Channel team is happy to announce our RTM version, available as part of the &lt;A class="" href="http://www.microsoft.com/downloads/details.aspx?FamilyId=10CC340B-F857-4A14-83F5-25634C3BF043&amp;amp;displaylang=en" target=_blank mce_href="http://www.microsoft.com/downloads/details.aspx?FamilyId=10CC340B-F857-4A14-83F5-25634C3BF043&amp;amp;displaylang=en"&gt;.NET v3.0 WCF components download&lt;/A&gt;. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;Thanks for trying out our technology and for helping us improve through all these releases..As always questions/feedback welcome.&lt;/P&gt;
&lt;P&gt;- The Peer Channel Team. &lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1401488" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/peerchan/archive/tags/Updates_2F00_News/default.aspx">Updates/News</category></item></channel></rss>