P2P sample code for .NET Core

We would like to upgrade from community edition to enterprise in order to avail peer to peer sync feature. Our application was developed in .NET Core 2.1 version. Is there any sample code available which deals with P2P and the communication framework in .NET Core. I found a link which was talking about a sample app (no idea where the app is). Please guide


@vjeeshc, yes we have sample app available for .net Core internally. Can you contact Customer support once it is upgraded to EE? You should be able to get the information.

Can you please provide a valid syntax/value for the target property (the code snippet is taken from Peer-Peer Documentation)
My scenario is to connect to a remote machine in the same LAN by using it’s name (let’s say TEST1234A is the machine name). Please guide

var messageEndpointTarget = new MessageEndpoint(uid: "UID:123", target: "", protocolType: ProtocolType.MessageStream, delegateObject: this);

There is no invalid value. It’s purely for your own use. It will be passed back to you when it is time to open the connection.

Thanks everyone. I have one more query regarding peer-peer.
We have written code in .NET core to implement peer to peer sync and it is working fine. However we would like to know more about how the conflict handling is implemented in peer-peer ? How can we explicitly configure the conflict handling in the code like LWW (may be I am asking a stupid question though)? When we tried to verify the conflicts, it seemed to be one machine always wins irrespective of which machine played what role (active/passive). Please guide

You can’t define custom conflict handling yet … we’re working on that for the next release.

Thanks Jens. Can you please share some details about how the conflicts are being handled when we sync peer to peer. This would help us to have a clear idea on how the document conflicts are going to be handled in our application. Is it merge strategy OR overwrite with the latest version ?

The details of what will become the “default conflict resolver” (and as of right now the only conflict resolver for replication, both peer to peer and otherwise) are as follows:

  1. Deletions always win
  2. If neither side of the conflict is a deletion, then the side with a longer edit history wins (i.e. how many times it was resaved into the database past the common ancestor)
  3. If the edit history is the same length then an arbitrary winner is chosen based on some internal information (this probably will not satisfy you, so sorry about that!). The information used is immutable and deterministic so regardless of where the resolution takes place it will always be the same on any device.

P2P is a bit weird because both sides are acting as a client. Whichever one of them pulls the conflicting revision from the other first will resolve it.

Thanks a lot Jim and Jens. We are looking for only push replication as per our requirement. In that case, what could be the potential risks with conflict handling? Is it same as what Jim mentioned in his previous reply?

Actually without pull you won’t be able to resolve the conflicts because the pusher will simply give up on a conflict, yielding to a future pull that will set up the resolution.