我可以从移动或浏览器中的网站连接Tcp服务器 [英] Can I Connect Tcp Server From Web Site In Mobile Or Browser

查看:269
本文介绍了我可以从移动或浏览器中的网站连接Tcp服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个网站,我想在其中显示连续的价格更新,我正在连接到在特定IP和端口上的MS Windows上运行的TCP服务器。

任何人都可以建议我如何使用可供移动网站使用的java脚本代码连接到该服务器,以便我可以获得持续的价格更新。

I am developing one website in which i want to show continuous price update for which i am connecting to TCP Server which is running on MS Windows on particular IP and port.
Can anyone suggest me how to connect to that server using java-script code which can be used by mobile web site, so that i can receive continuous price update.

推荐答案

使用JavaScript连接服务器在浏览器端创建TCP Socket连接并不简单。尽管像Websockets这样的解决方案允许创建类似于套接字的东西,但您可以使用它们仅连接到支持 Websockets 的服务器[< a href =http://en.wikipedia.org/wiki/WebSockettarget =_ blanktitle =New Window> ^ ]。



也许,你可以看一下像 SignalR [ ^ ]将更新推送到浏览器。



查看这些链接以了解更多信息:



http://artemyankov.com/tcp-client-for-browsers/ [ ^ ]



SignalR简介 [ ^ ]
It's not simple to create TCP Socket connection on the browser end using JavaScript to connect to a server. Although solutions like Websockets allow to create something that resemble sockets, you can use them to connect only to servers that support Websockets[^].

Perhaps, you could look at something like SignalR [^]to push the updates to your browser.

Look at these links to understand more:

http://artemyankov.com/tcp-client-for-browsers/[^]

Introduction to SignalR[^]


这篇关于我可以从移动或浏览器中的网站连接Tcp服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆