This article discusses:
Message transfer in the. NET Compact Framework
Writing a simple Messaging application
WCF Message Transfer Insider detection
Consuming WCF WEB Services
This article uses the following techniques:
. NET Compact Framework 3.5, Visual Studio 2008
The ability to address mobile devices has always been tricky, making it difficult to write Windows mobile® applications that receive push data from the server. Small devices generally do not have static IP addresses or dynamic DNS entries that are bound to them. A common workaround for this type of device is to send an HTTP request to the server when the device is online, and then the server causes the request to wait until the content is pushed to the device. At this point, the server uses the updated content to respond to the request that has been waiting, while the device sends another request to wait for the next update when it starts processing the update content.
This workaround affects the scalability of the server because it must suspend many requests at the same time instead of responding to them immediately and shutting down the connection. This also shortens the battery life of the device because the device must always remain connected. If the device is not turned on when the server's updates are ready, the server will not be able to send updates, and it must discard the updates or continue to retain this state, that is, which of the devices are provided with which updates. Finally, if the network is unavailable, the application cannot send or receive messages.
Visual studio®2008 provides developers of Windows Mobile applications with access to windows®communication through the microsoft®.net Compact Framework 3.5 Founda tion (WCF) feature subset, which solves many of these problems because the tool includes two new WCF binding elements that are very useful for sending and receiving messages using e-mail transmissions. Because many devices already have e-mail synchronization capabilities, these transports can create addressable message queues with the inherent queuing nature of e-mail and an e-mail server that has been established on the Internet, which can be point-to-point, with true message push Message-level communication of the device to the server and the server to the device. In this article, I will outline the WCF subsets supported by the. NET Compact Framework 3.5, and how to leverage these transports and tools in mobile applications.