Thursday, June 16, 2011

Silverlight: How to Send Message to Desktop Application

Summary
This is a very simple example showing how to send a message from Silverlight application to standalone desktop application.


Introduction
The example below shows how to use Eneter Messaging Framework to send text messages from Silverlight application to standalone desktop application using TCP connection.
(Full, not limited and for non-commercial usage free version of the framework can be downloaded from http://www.eneter.net/. The online help for developers can be found at http://www.eneter.net/OnlineHelp/EneterMessagingFramework/Index.html).
When we want to use the TCP connection in Silverlight, we must be aware of following specifics:
The Silverlight framework requires the policy server.
The Silverlight framework allows only ports of range 4502 - 4532.


Policy Server
The Policy Server is a special service listening on the port 943. The service receives '<policy-file-request/>' and responses the policy file that says who is allowed to communicate.
Silverlight automatically uses this service when it creates the TCP connection. It sends the request on the port 943 and expects the policy file. If the policy server is not there or the content of the policy file does not allow the communication, the TCP connection is not created.

SilverlightTcpConnection.gif


Read more: Codeproject