Click here to Skip to main content
15,888,610 members
Articles / Programming Languages / C#

Scalable State Synchronization using P2P - Part 2 - Running the Test Application

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
3 Mar 2011Ms-PL2 min read 9.8K   3  
Scalable state synchronization using P2P - Part 2 - Running the test application

I recommend you read the previous post before this one.

Prerequisites

Enable PNRP. (Windows 7 should already enable it by default.) Look here to learn how to do it.

  • I recommended to run the test application and check that at least both instances are well synchronized before implementing your own synchronization business logic. To ensure that it works well and in case there are issues, they are in the implementation level. The application exists in: [Project directory]Roniz.WCF.P2P.ApplicationTester\bin\Debug\Roniz.WCF.P2P.ApplicationTester.exe.

Here is how the test application looks:

Image 1

Connect to the Mesh

Clicking on "connect" will open the channel and the state can be determined in the diagnostic details section of the window. First, change every WCF channel from "create" -> "opening" -> "opened" and it will insert the own data as it entered in the user details section. Then, when other peers join the mesh, both peers should change the state to "online" and both peers will synchronize their information.

The following screenshot shows the state that occurs when peers A & B connect to the mesh and are in "opened" state. Prior to coming online (connect with at least one other peer), so every peer shows their own data, but is not synchronized yet (peer C is not connected yet).

Image 2

Next the peers that are in an opened state, automatically begin to try to connect to each other. When a peer is connected to at least one other, its state changed to "online" and the synchronization flow begins.

In the following screenshot, peers A & B are connected and in an online state – so they are synchronized. Peer C is not connected yet.

Image 3

Updating the Mesh

Clicking on "send update of own details" will update all peers with the information of their own data as it is entered in the user details section.

In the following screenshot, peer D sends an update message with the data "some new data" to peers A, B & C.

Image 4

Disconnecting from the Mesh

Clicking on disconnect will notify the other online peers and remove the row that represents the peer that disconnected. In this screenshot, peer D disconnected, and the other peers removed his data from their own business logic level.

Image 5

Now, you can go to the next post that explains how to implement this infrastructure.

License

This article, along with any associated source code and files, is licensed under The Microsoft Public License (Ms-PL)


Written By
Mandalogo / E4D Solutions
Israel Israel
My name is Ron Zigelman and I am a .NET ,P2P-WCF expert and consultant. I will share some code examples that can help in some development issues. You can contact me at
roniz.net@gmail.com

Comments and Discussions

 
-- There are no messages in this forum --