views:

1232

answers:

8

I have 50+ kiosk style computers that I want to be able to get a status update, from a single computer, on demand as opposed to an interval. These computers are on a LAN in respect to the computer requesting the status.

I researched WCF however it looks like I'll need IIS installed and I would rather not install IIS on 50+ Windows XP boxes -- so I think that eliminates using a webservice unless it's possible to have a WinForm host a webservice?

I also researched using System.Net.Sockets and even got a barely functional prototype going however I feel I'm not skilled enough to make it a solid and reliable system. Given this path, I would need to learn more about socket programming and threading.

These boxes are running .NET 3.5 SP1, so I have complete flexibility in the .NET version however I'd like to stick to C#.

What is the best way to implement this? Should I just bite the bullet and learn Sockets more or does .NET have a better way of handling this?

edit: I was going to go with a two way communication until I realized that all I needed was a one way communication.

edit 2: I was avoiding the traditional server/client and going with an inverse because I wanted to avoid consuming too much bandwidth and wasn't sure what kind of overhead I was talking about. I was also hoping to have more control of the individual kiosks. After looking at it, I think I can still have that with WCF and connect by IP (which I wasn't aware I could connect by IP, I was thinking I would have to add 50 webservices or something).

+4  A: 

WCF does not have to be hosted within IIS, it can be hosted within your Winform, as a console application or as windows service. You can have each computer host its service within the winform, and write a program in your own computer to call each computer's service to get the status information.

Another way of doing it is to host one service in your own computer, and make the 50+ computers to call the service once their status were updated, you can use a database for the service to persist the status data of each node within the network. This option is easier to maintain and scalable.

P.S. WCF aims to replace .net remoting, the alternatives can be net.tcp binding or net.pipe

codemeit
+1  A: 

I'd suggest using .NET Remoting. It's quite easy to implement and doesn't require anything else.

orrsella
Yes, if the target framework is .NET in Windows it must go with .NET Remoting.
milot
A: 

For me its is better to learn networking.. or the manual way of socket communication.. web services are mush slower because it contains metadata..

your clients and the servers can transform to multithreaded application. just imitate the request and response architecture. it is much easy to implement a network application like this..

Aristotle Ucab
A: 

If you just need a status update, you can use much simpler solution, such as simple tcp server/client messaging or like orrsella said, remoting. WCF is kinda overkill here.

One note though, if all your 50+ kiosk is connected via internet, then you might need use VPN or have an open port on each kiosk(which is a security risk) so that your server can retrieve status update from each kiosk.

We had a similiar situation, but the status is send to our server periodically, so we only have 1 port to protect/secure. The frequency of the update is configurable as to accomodate slower clients.

faulty
+2  A: 

Unless you have plans to scale this to several thousand clients I don't think WCF performance will even be a fringe issue. You can easily host WCF services from windows services or Winforms applications, and you'll find getting something working with WCF will be fairly simple once you get the key concepts.

I've deployed something similar with around 100-150 clients with great success.

There's plenty of resources out on the web to get you started - here's one to get you going:

http://msdn.microsoft.com/en-us/library/aa480190.aspx

Whisk
+2  A: 

Whether you use a web service or WCF on your central server, you only need to install and configure IIS on the server (and not on the 50+ clients).

What you're trying to do is a little unclear from the question, but if the clients need to call the server (to get a server status, for example), then they just call a method on the webservice running on the server.

If instead you need to have the server call the clients from time to time, then you'll need to have each client call a sign-in method on the server webservice each time the client starts up. The sign-in method would take a delegate method from the client as a parameter. The server would then call this delegate when it needed information from the client.

Setting up each client with its own web service would represent an inversion of the traditional (one server, multiple clients) client/server architecture, and as you've already noted this would be impractical.

MusiGenesis
+2  A: 

Do not use remoting.

If you want robustness and scalability you end up ruling out everything but what are essentially stateless remote procedure calls. Since this is exactly the capability of web services, and web services are simpler and easier to build, remoting is an essentially pointless technology.

Callbacks with remote delegates are on the performance/reliability forbidden list, so if you were thinking of using remoting for that, think again.

Use web services.

I know you don't want to be polling, but I don't think you need to. Since you say all your units are on a single network segment then I suggest UDP for broadcast change notifications, essentially setting a dirty flag, and allowing the application to (re-)fetch on demand. It's still not reliable but it's easy and very fast because it's broadcast.

As others have said you don't need IIS, you can self-host. See ServiceHost class for details on how to do this.

Peter Wone
A: 

As someone who implemented something like this with over 500+ clients and growing:

Message Queing is the way to go.

We have gone from an internal developed TCP server and client to WCF polling and ended up with Message queing. It's the only guaranteed way to get data to and from clients and servers over the internet. As a bonus, many of these solutions have an extensive framework makeing it trivial to implement publish-subscribe, Send-one-way, point-to-point sending, Request-reply. Some of these are possible with WCF but it will involve crying, shouting, whimpering and long nights not to mention gallons of coffee.

A couple of important remarks:

Letting a process poll the clients instead of the other way around = Bad idea.. it is not scalable at all and you will soon be running in to trouble when the process is take too long to complete.. Not to mention having to handle all the ip addresses ( do you have access to all clients on the required ports ? What happpens when the ip changes etc..)

what we have done: The clients sends status updates to a central message queue on a regular interval ( you can easily implement live updates in the UI), it also listens on it's own queue for a GetStatusRequest message. if it receives this, it answers ( has a timeout).. this way, we can see overal status of all clients at all times and get a specific status of a specific client when needed.

Concerning bandwidth: kiosk usually show images/video etc.. 1Kb or less status messages will not be the big overhead.

I CANNOT stress enough that the current design you present will have a very intensive development cycle AND will not scale or extend well ( trust me, we have learned this lesson). Next to this, building a good client/server protocol for this type of stuff is a hard job that will be totally useless afterwards if you make a design error ( migrating a protocol is not easy)

We have built our solution ontop of ActiveMQ ( using NMS library c#) and are currently extending Simple Service Bus for our internal workings.

We only use WCF for the communication between our winforms app and the centralized service(s)

Noctris