开发者

Is it possible to read data from a local port using Javascript or ASP.NET?

I written the following to broadcast a data in a Windows Application using C#

 UdpClient server = new UdpClient("127.0.0.1", 9050);

            string welcome = "Hello, are you there?";
            data = Encoding.ASCII.GetBytes(welcome);
      开发者_如何学C      server.Send(data, data.Length);

But, How can I read the same data by a web application using javascript or asp.net?


You can do this via a webservice or wcf service. Javascript can be serialized into JSON. Have a look at the json website to check out the syntax. I have used JQuery to do the ajax communication to call the webservice in the past. The all you need to do to convert this back to a javascript object is

var myObject = eval(myTransferObject)
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜