Search code examples
.netwcfsocketscompact-frameworkembedded

Controlling multiple bots over TCP/IP


I'm working on a project that involves controlling of multiple wheeled robots (running .NET Compact Framework) within a single network over TCP/IP.

The control may take place from outside the network.

Initially I was opting for Sockets, but later WCF seemed to be a better option.

The network architecture involves, one Server hosting a WCF service and a control queue for every device in the network. The client application connects to the server from inside/outside the network, finds the suitable device and starts control.

Once a device is initialized, it keeps polling the WCF service to check for new commands on its queue, while the client application sends commands into the appropriate queue.

I wanted to know, how good is this solution for minimal latency? Is there way I can remove the polling, and force the server to send interrupts to the devices ones a new command ships in?

What improvements could I make to reduce the latency?


Solution

  • WCF supports full duplex communications... so you'll definitely want to remove the "Polling" architecture, and simply have the server send a command to the clients as the user presses a button (or whatever the controls are).

    There are a lot of good tutorials out there on WCF... this is an article I wrote years ago - but it's very simple and could be a good start: Client Server Programming with WCF

    EDIT: That article goes compares doing things the "Sockets" way, and how WCF makes it easier. Also, I forgot to mention the answer to your latency question - if you use the "net.tcp" binding (used in the article), it will perform perfectly fast.