.NET WCF - update client user interface during server processing

I am new when it comes to client / server application. (I only programmed asp.net applications)

I want to create an application containing several WinForm and .NET Server clients (I think of WCF). The connection between the client and the server must be on http (port 80).

Application script:

The client will pass the keyword to the server, for example "books."

Then the server will start the search process by search for 1 second. - 10 minutes based on this keyword.

The server will find a list of results (from 1 result to N results).

I would like the client to update the GUI with the results found during server search. (Do not wait for the server to shut down).

My questions:

Is WCF the right choice for the server side?

What is WCF protocol? Duplex, poll, MSMQ?

Any links to the corresponding sample code, starter kit, etc. welcome :)

+4
source share
2 answers

If you use WCF, MSMQ will be the transport layer ("binding" to using WCF terminology) and has little to do with what you are trying to do here (you would choose between NetMsmqBinding vs. WsHttpBinding versus NetTcpBinding , to name a few). You can use either polling or duplex binding, or they will either be fully valid, although the implementation will differ significantly.

To implement a polling approach, I would recommend using a session-based WCF service. Your session will continue until you hold the proxy server for your WCF service on your client, and you will use the same proxy server to receive updates on your request until it finally returns with the status Completed. It seems pretty simple to implement for both the client and the service.

Using a duplex service will also be a valid approach, but it can be harder to implement if you have never worked with WCF. When you use a duplex service in your ServiceContract definition, you define a CallbackContract , which is another ServiceContract that your service uses to send messages back to the client. In your case, I think you will need 2 different operations in your CallbackContract , one to report each result, and a separate one to indicate that all results were received, so your client knows that he does not expect any results and closes the channel, Documentation The MSDN for Duplex Services is thorough enough, but definitely a bit of a learning curve with WCF.

+1
source

Since I just take a punch, I just give you this pointer to start watching.

Use Stream as the return type and use IEnumerable, while returning income every time you go through the record search. If you manually arrange each entry in JSON, you can dump data by stream.

A potential example for the client side would be to try using the Twitter streaming API ( http://dev.twitter.com/pages/streaming_api ), which allows you to test the client side of Stream and check the backend of your proof of concept before accepting the server side.

0
source

All Articles