During my experience with Silverlight 2 beta 1 and the use of sockets I have collected some comments that may help you starting with sockets inside Silverlight:
- The current beta version 1 of Silverlight 2 starts a reverse DNS lookup for the host name you connect to (more details). This will be changed in future versions.
- To connect to a server you have to create an instance of DnsEndPoint class which can be done like this:
- One additional restriction on Silverlight 2 beta 1 is that the port range that a network application is allowed to connect to must be within the range of 4502-4532. These are the only ports allowed for connection from the current beta except the port number the .XAP file is downloaded from which is by default port 80 for http Web applications.
- There is no synchronous connect, send or receive available (I'm very happy about that!).
- IPv4 or IPv6 are both available depending if local computer has support enabled for each.
DnsEndPoint endPoint = new DnsEndPoint( Application.Current.Host.Source.DnsSafeHost, Application.Current.Host.Source.Port);
Site of origin connectivity is intended only as an interim solution in the beta 1 until the full cross-domain model can be put in place for Silverlight 2.
I got a question if it is possible to start a socket listener on the client-side Silverlight application. Well, I cannot find any info that this will be able as I don't see any real use of it. Replacing polling is already very easy by opening a socket to a server and waiting for any response (on event). The next days I will publish my chat example using sockets online.