开发者

Sockets with Silverlight 4

开发者 https://www.devze.com 2022-12-29 20:26 出处:网络
I need to implement a persistent socket connection from my in-browser Silverlight 4 app to a device on the network.

I need to implement a persistent socket connection from my in-browser Silverlight 4 app to a device on the network.

I need the following:

  1. Connect to it and keep a persistent connection
  2. Send and Receive data
  3. Get some type of event or notification (or detect it) when the connection drops.

Is this possible with Silverlight开发者_Go百科 4? If so, can someone point me to some examples? All I am finding are some attempts at it with Silverlight 2.


This is possible. For details, see Working with Sockets on MSDN.

That being said, you are limited here. You can only use the Asynchronous methods in Socket, and you can only use Tcp connections. Given your requirements, however, this shouldn't be a problem. Any asynchronous TCP communication tutorial for C# (including non-silverlight) should apply here, as it will work in Silverlight 4 as well.

0

精彩评论

暂无评论...
验证码 换一张
取 消