Peer to Peer WinRT?

Peer to Peer WinRT?

Old forum URL:

RPisarzJr posted on Sunday, October 21, 2012

I am about to rewrite a two-player game and for this version I want to add support for peer to peer connections. One player will start the game and host a session and the opponent can then connect. I plan on building on top of CSLA .NET, but what is not clear is Win8 WCF/Networking support to achieve Peer to Peer. Does WinRT support something like this? Or, do I need to build against the full .NET API? Any specific considerations regarding CSLA .NET usage in either scenario?

JonnyBee replied on Sunday, October 21, 2012

I think you will find this hard to do as WinRT applications is client only - and you cannot create a WCF Service to serve data.

BR230302.collapse_all(en-us,VS.110).gifWCF changes

In Windows Store apps, you can utilize Windows Communication Foundation (WCF) client functionality to retrieve data from a WCF service, but you cannot create a WCF service to serve data.

So I assume you will need to create a .NET backend/intermediary and use dual channel WCF to send/receive messages to/from server.

CSLA is typically only using one.way bindings so you may find that CSLA can be helpful on the client for validation/business rules - but not so much for the server part and dual channel communication.

RPisarzJr replied on Sunday, October 21, 2012

At this point I'm not planning a server component, but rather prefer client to client direct communication if possible. Is it possible to configure CSLA to use a dual channel binding, or is that custom code I'd have to write? What would be the appropriate dual channel binding to use?

Thanks for your insight, I appreciate it.

RockfordLhotka replied on Monday, October 22, 2012

CSLA doesn't include or prevent the use of peer-to-peer concepts. It is neutral on the concept.

I don't think you can host a receiver/server on WinRT, but maybe you can - I've never tried. If you figure it out, you should blog about it, because this is something I haven't seen documented anywhere.

If you can host a receiver on WinRT, you should be able to create your own data portal host that delegates into a Csla.Server.DataPortal object, just like the host does for WCF. The 'Using CSLA 4: Data Portal Configuration' book talks about creating custom proxy/host types, though not quite for something like you are describing. Still, the basic concepts are the same, as long as you can actually implement a receiver on WinRT.

RPisarzJr replied on Tuesday, October 23, 2012

I haven't seen it documented either (which is why I reached out to the forum), but I will definitely post if I am able to find a solution. I'll revisit the custom proxy/host types in the Data Portal Configuration book to gain a better understanding. Thanks again for your insight.

I've been following your work since VB5 and truly appreciate all your efforts.

Copyright (c) Marimer LLC