Inside and Out…

An attempt to understand technology better…

Archive for the ‘Distributed Communications’ Category

WinToolZone.Bluetooth – Managed Bluetooth API for the desktop

Posted by Gaurav Khanna on July 5, 2006

One of the communication protocols not present in .NET Framework class libraries is Bluetooth. So today, I started to work on my implementation of a managed API for Bluetooth programming – WinToolZone.Bluetooth. I am authoring it using Managed C++ and leveraging the Microsoft Bluetooth stack APIs.

I just completed implementing the support for enumerating the Bluetooth radios on a machine. Below is a C# program that exemplifies how they can be enumerated:

using System;
using System.Collections.Generic;
using System.Text;
using WinToolZone;

namespace BTHCSClient
    class Program
        static void Main(string[] args)
            Bluetooth bth = new Bluetooth();
            if (bth.RefreshRadios())
                foreach (BluetoothRadio radio in bth.Radios)
                    Console.WriteLine("RadioName: {0}", radio.Name);
                    Console.WriteLine("Address: {0}", radio.Address.ToString());
                    Console.WriteLine("ManuID: {0}", radio.ManufacturerID);
                    Console.WriteLine("LMPSubversion: {0}", radio.LMPSubversion);
                    Console.WriteLine("DeviceClass: {0}", radio.DeviceClass);
                Console.WriteLine("Unable to enumerate BTH radios");

Technorati : , , , , , , : , , , , , ,
Buzznet : , , , , , ,
43 Things : , , , , , ,


Posted in .NET Framework, Development, Distributed Communications, Managed C++ | 1 Comment »

WS-Sudoku for WinFX

Posted by Gaurav Khanna on May 24, 2006

Sometime back, I had authored WS-Sudoku that was a game of Sudoku built using Windows Communication Foundation (WCF) to illustrate multi-player gaming using callbacks over WSDualHttpBinding.

This was subsequently modified by the WCF Team to leverage the three pillars of WinFX: WPF, WCF and WWF. It has been made available for download, with its source code, for you to see the richness of WinFX as a developer platform.

Download it from here.

Posted in .NET Framework, Distributed Communications, Downloads, WinFX | Leave a Comment »

[Download] WS-Sudoku: Multi-player Sudoku over Windows Communication Foundation (WCF)

Posted by Gaurav Khanna on February 9, 2006

WS-Sudoku has two facets:

WS-Sudoku is my implementation of the Sudoku game that allows multi-player game. An individual can start a game in service mode, to which other players can connect to and solve the game together.

The game uses WSDualHttpBinding and uses callback contracts, in a publisher-subscriber model, for notifying all connected players about the moves made by other players. As players join or exit the game, the notifications are sent in real time to other players in the game. It has been built using WCF November CTP. You would require the following components to be installed on your machine:

Below is a screen shot of the game:

Finally, it can be installed using ClickOnce so that it will auto-update itself when updated for more features.

To download as a zipped archive, or install it over-the-web, visit

Technorati : , , , , : , , , ,
43 Things : , , , ,

Posted in .NET Framework, Distributed Communications, Downloads, WinFX | 1 Comment »

SoapSuds and Remoting – Issues using CAO under .NET Framework 1.1

Posted by Gaurav Khanna on May 14, 2004

Over the past weekend, I was working on implementing a Remoting Server that would serve CAO (Client Activated Object) to my Remoting client.

Went ahead, implemented the Remotable class and did a RegisterActivatedServiceType. Then, for the Remoting client to have the metadata, I used the SoapSuds extract the metadata and provide reference to the client. So far so good.

But then I executed my client, I got a deserialization error. Here’s the Microsoft KB article that discusses this error:;en-us;823445

Ofcourse, you will need to get the service pack to get around this problem. But what do you do if that’s not available? So, here’s a workaround to this issue is this:

1) Write your Remotable class which is MarshalByRefObject

class MyRemotableClass : MarshalByRefObject, IRemotableClass
// implementation comes here

IRemotableClass is the interface that your class implements and will be shared with the client to provide it with metadata.

2) Write a factory class that will be create a new instance of your Remotable class:

class MyRemotableClassFactory : MarshalByRefObject, IRemotableClassFactory
// This is the factory method that will return a new instance of the RemotableClass;
// Thus, we have a CAO behaviour.
public IRemotableClass GetNewInstanceOfRemotableClass()
return new MyRemotableClass();

IRemotableClassFactory interface serves the same purpose as IRemotableClass interface above.

3) Now, write your Remoting client that connects to the server (which got activated using RegisterWellKnownServiceType) using RegisterWellKnownClientType.

And you have a CAO implementation for yourself 🙂 BTW, this issue is observed when the Remoting Server is running on .NET Framework 1.1 and not 1.0!

Posted in .NET Framework, Development, Distributed Communications, Tips | Leave a Comment »