Silverlight 2 Sockets
This is a Silverlight socket application developed in Blend 2 and Visual Studio 2008.
Click here for links to run the application / download the source code.
This application comprises two main parts:
- A windows service socket server streaming data
- The Silverlight client socket application
The windows service implements both a port 943 Silverlight client access policy socket server and a streaming data socket server. All socket operations are performed asynchronously. The runnable application sample is hosted in a shared hosting environment therefore the windows service socket server is hosted remotely and the Silverlight application is performing a cross domain socket connection over the internet.
The Silverlight application introduces data binding of the UI to a business object that supports the INotifyPropertyChanged interface and an ObservableCollection for the streamed data.
Data is streamed continuously from the windows service to connected clients on a one second interval. The windows service supports multiple connected clients - all clients will receive the same data simultaneously. The application implements a simple data framing mechanism in the Wire class - this class is intelligent enough to know how to serialize and deserialize the binary data sent over the wire. The Wire class is shared between the windows service and the Silverlight application.
The Silverlight UI includes a simple connect / disconnect button to enable socket connection control. As data is received by the Silverlight application it is displayed in real-time in a chart. The chart is from the Silverlight 2 Toolkit (March 2009).
The socket code both client and server side intelligently detects both normal and abnormal socket disconnections.

Read me
Run the sample
Download the source code