Connect Mac (or C ++) with binary WCF

I have a WCF service hosted using TCP / IP (netTcpBinding):

var baseWcfAddress = getWcfBaseUri(); host = new ServiceHost(wcfSingleton, baseWcfAddress); var throttlingBehavior = new System.ServiceModel.Description.ServiceThrottlingBehavior(); throttlingBehavior.MaxConcurrentCalls = Int32.MaxValue; throttlingBehavior.MaxConcurrentInstances = Int32.MaxValue; throttlingBehavior.MaxConcurrentSessions = Int32.MaxValue; host.Description.Behaviors.Add(throttlingBehavior); host.Open(); 

I would like to write a Mac client in Objective-C or C ++. Are there any existing classes that can make it easier to connect to my WCF service? If not, what are my steps and opportunities to do this?

+7
source share
2 answers

Each binding starting with net is considered incompatible. Even a pure .NET client without WCF cannot communicate with the service without great effort, redefining the entire binary protocol and encoding. You should probably start with:

Your Mac version uses Mono , which should support netTcpBinding.

Your real option for Objective-C / C ++ on Mac is creating a compatible WCF service that provides data over HTTP. If you do not own the service, you can create a WCF service routing that will bridge between the interacting HTTP and netTCP.

Edit:

One more thing - if the service uses netTcpBinding with the default configuration, it is protected by Windows security. I expect this could be another show stop on the Mac.

+7
source

In the context of the comment:

netTcpBinding been recognized as one of the faster options - of course, much faster than the Vanilla BasicHttpBinding / WS binding that has been verified. This is the only real need, since netTcpBinding used binary vs direct text, which was faster.

Firstly, I looked at this many, many times - and strangely enough, every time I test, netTcpBinding cannot completely be faster than the basic xml sentence. However, since performance is your goal, I have options ...

I am a bit biased (since I wrote it), but I highly recommend "protobuf-net" here; since it is designed according to the same idioms as most .NET serializers, it is fairly easy to swap, but it is faster (CPU) and less (bandwitdh) in every test I do for this, or checks what other people do . And since the protobuf format is an open specification, you don’t have to worry about the "Net" bindings being incompatible.

For MS.NET, I have direct WCF interceptors that can be used exclusively from the configuration , which gives it a breeze. I honestly don't know how well this will work with the Mono equivalent - I haven't tried it. This might work, but if not another option, just throw a byte[] or Stream over the network and worry about serializing (de) manually.

My preferred location here is basic-http binding with MTOM enabled, which gives you the simplicity and portability of the simplest xml binding, without the overhead of base 64 for binary data.

0
source

All Articles