Application Space with Compact Framework

Despite of some small differences, the functionality of the appspace version for compact framework is nearly the same as in the standard version. The main differences are:

  • TCP transport only (any other transport services are currently not supported)
  • The filter functionality of the publish/subscribe feature is not available (this is because of limitations in compact framework)
  • Receive() method doesn't allow defining the thread sync context (this is because of limitations in compact framework - you'll unfortunately have to handle async calls to Winforms yourself)

Despite of that, you won't see any notable differences. Let's see how running a mobile client and connecting to a server looks like:

Mobile Client

This is how instantiating an AppSpace and connecting to a worker looks like with compact framework:

var space = new XcoAppSpace("tcp.port=0"):
var worker = space.ConnectWorker<PCompactWorker>("serveraddr:8000/myworker");

You see that there is no difference to the standard version of the AppSpace - just start the appspace, connect to your worker and start sending messages!

Server for Mobile Clients

Compared to a scenario without mobile clients, there are a few things that you need to think of when preparing your server space:

  • Communication is only possible with the TCP transport service - so your server space needs one installed (remember that you can also use multiple transport services in one space instance, if you need to)
  • For serialization the default binary serializer is not suitable - you need to use the XcoJsonSerializer which serializes messages in Json format, interoperable to the Compact Framework version
var space = new XcoAppSpace("tcp.port=8000;serializer=json"); 
space.RunWorker<PCompactWorker, CompactWorker>("myworker"); ...


You may wonder how to best define a contract in such a scenario. Normally you would define a contract assembly and add a reference to this assembly to the client and server project. In this case the client and server projects are using different framework versions, so this is not directly possible. An easy way in this situations has proven to be linking the code files where the contract is defined into both projects directly. You can find an example for that in our usage demos.

Last edited Dec 21, 2012 at 1:23 PM by thomass, version 5


No comments yet.