WCF from theory to Practice (8): Event broadcast

Source: Internet
Author: User

The three types of message exchange modes in WCF are discussed above, One-way,request/reply,duplex. The first two relatively simple, needless to say, duplex relatively complex, the above just to achieve a simple callback, in the real application, there are many noteworthy, this article on the combination of a practical example to discuss the specific application of duplex and very worthy of our attention.

The starting point of this article

By reading this article, you can understand the following knowledge:

How to implement an event broadcast based on duplex

Analysis of several problems in realizing duplex event broadcasting

A preliminary discussion of asynchronous

This article is suitable for readers

This article is a moderately difficult article that requires basic knowledge about WCF message exchange and Windows application development, and for WCF message exchange, read WCF from theory to Practice (7): Message Exchange Mode

How to implement an event broadcast based on duplex

Before discussing how to do this, look at what the example of this article is going to accomplish. The example in this article implements a simple distributed task management system that, in short, performs a task (job) on the server point, and renders the task's information to the client. It has the following characteristics:

By invoking the service-side accept (), the client can connect to the server and maintain the session.

At the time the client starts, it is possible to remotely invoke Getjobs () to get all the tasks in the current server and present them to the list control in the client form

The client can add a task to the server by calling AddJob (), and when the server completes the add operation, the event is raised to add completion and the event is broadcast to all clients

When a new task event broadcast is sent by the client server, the client adds the new task to the list control to render

The client can command the server to perform a specific task, and when the task begins execution and execution, the server ends up acting like a full client broadcast task, and the execution of the task and the broadcast of the event are performed asynchronously

After the client receives the broadcast, it can update the task information.

Unlike previous articles, this article first gives the effect of the final implementation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.