How to use Socket in Microsoft Silverlight 3
This article has been archived. It is offered "as is" and will no longer be updated.
This article describes an All-In-One Code Framework sample that is available for download. Silverlight provides Socket API which gives the great flexibility for Silverlight network programming. This article describes the usage difference between Silverlight Socket and .Net Socket. This code sample demonstrates how to write Visual C#, or Visual Basic.NET code to perform Socket in Silverlight to communicate with socket server.
Download informationTo download this code sample, click the following link:
Technical overviewFor performance consideration, unlike .Net Socket class, Silverlight Socket class only support asynchronous pattern method. To perform an asynchronous call, the typical processes are as in the following section:
- Create and initialize SocketAsyncEventArgs class, write eventhandler and register it to SocketAsyncEventArgs's completed event.
- Call Socket asynchronous method by using the SocketAsyncEventArgs class as parameter. If method returns False, the socket action returns result synchronously. If method returns True, the socket action returns result by SocketAsyncEventArgs.Completed event.
- When socket action returns result, SocketClient class checks the SocketAsyncEventArgs class and handles the result.
For more information about network security access restrictions in Silverlight, please visit the following website:
Note For more information about how to create the sample application and how to deploy the sample application, see the Readme.txt file that is included in the download package.
LanguagesThis code sample contains the following programming languages:
- This sample application was created by using Visual Studio 2008 with Service Pack 1 installed.
- Silverilght 3 runtime
- Silverlight 3 Tools for Visual Studio 2008 SP1
- Socket, Silverlight
What is All-In-One Code Framework?All-In-One Code Framework shows most Microsoft development techniques by using code samples in different programming languages. Each example is carefully selected, composed, and documented to show one common code scenario. For more information about All-In-One Code Framework, visit the following Web site:
How to find more All-In-One Code Framework samplesTo find more All-In-One Code Framework samples, you can simply click the following link:
For more information, visit the following Web sites:
Article ID: 2278179 - Last Review: 12/12/2015 09:37:59 - Revision: 2.0
Microsoft Visual Studio 2008 Service Pack 1
- kbnosurvey kbarchive kbcodefx kbsurveynew kbinfo kbnomt atdownload kbrapidpub KB2278179