tags:

views:

1431

answers:

4

I am looking at building a client server application in C# using winforms or WPF. The client application must be a local application because it has to interact with specialised hardware.

The architecture I'm looking for is the client connects to a server port using TCP/IP. The client will then make requests to the server and the server will send responses to the client. The client wills stay connected to the server while the user is logged in.

I have looked at web services and as far as I can figure out, WCF extends web services which means there is no way for the server to send a message to the client.

Am I incorrect about WCF? If not what is the best way to accomplish this?

+3  A: 

WCF supports duplex messaging which should accomplish what you need.

See also: http://msdn.microsoft.com/en-us/library/cc645027(VS.95).aspx

flesh
+1  A: 

Try reading this article by Juval Lowy which is an excellent discussion of the issues in WCF messaging. He offers an alternative to duplexing which is his pub-sub framework. I'm going to have to recommend you buy his WCF book as well. He is one of the best technical authors I have come accross on any subject.

Jimmy McNulty
+1  A: 

Thanks. That is exactly what I want. I found two very helpful solutions too:
http://www.codeproject.com/KB/WCF/WCF_Duplex_UI_Threads.aspx
http://www.thoughtshapes.com/WCF/ExampleThree.htm

John Oxley
A: 

I know WCF is the bee's knees and all - but I'd probably just do a TcpServer and TcpClient pair. Then again, perhaps I'm the only one who thinks WCF is way too complicated for the 80% case.

Then again, if you have disparate clients or servers or something - you may want to look into WCF. But, for simple network socket stuff - well, we've been doing socket programming for years without WCF and have done pretty well with it.

Mark Brackett