I have TCP Socket server and would like to make asynchronous Silverlight client for it, but I cannot find any useful information on that. To be exact, I need three steps: connect, send and receive.
No need for it to be very detailed, just the idea how to build it to connect to the server at least.
By the way, I use Silverlight 5.
Thank you very much, Karel Frajtak for the link to video about sockets in Silverlight!
Everything is shown and explained in that video tutorial, so I recommend everyone who needs sockets in Silverlight to watch it!
Here’s the solution that I needed, with explanations what does what and my comments:
I assume that all the connection actions will be handled by separate class SocketConnection:
For socket connection in Silverlight to be successful, there HAS to be
OR
If you choose to use socket server, here’s a working sample source code:
Sample taken from here and it says there that
and says nothing about possibility to host it on HTTP server, just because the article is too old.
That’s about it. Run the cross-domain policy server first and your client only then, to make sure the connection will succeed.
If you need an asynchronous WPF socket server sample, just ask and give me link to the question! I have one built with async-await keywords, to be as simple as possible.
Good luck in everything!