简体   繁体   English

使用HTML和Javascript进行2种方式的通讯?

[英]2 way communication using HTML and Javascript?

I've been looking for a while for a simple solution to what seems like a relatively simple problem, but I just cannot for the life of me manage to find it. 我一直在寻找一个看似相对简单的问题的简单解决方案,但是我一生都无法找到它。

So here is what I am trying to do: 所以这是我要做的事情:

  1. Server (Hosting an HTML file, Has a variable, x, which is a javascript variable) 服务器(托管HTML文件,具有一个变量x,它是一个javascript变量)
  2. Server is running on my local network (192.168.xx, with no security) 服务器正在我的本地网络上运行(192.168.xx,没有安全性)
  3. Client, PC, has access to SSH, Telnet, whatever, and wants to communicate over TCP/IP 客户端PC可以访问SSH,Telnet,并且希望通过TCP / IP进行通信

So my question is this: How can I get the client to send a value, over TCP/IP, to the server, changing the value of that variable? 所以我的问题是:如何让客户端通过TCP / IP向服务器发送一个值,以更改该变量的值?

I can see that there are rather complex ways to do this, using websockets, sockJS, and other complex solutions, but if anyone knows of a super simple way to do this, please let me know. 我可以看到使用websockets,sockJS和其他复杂的解决方案有很多复杂的方法,但是如果有人知道执行此操作的超级简单方法,请告诉我。

Thanks :) 谢谢 :)

You'll want to use sockets. 您将要使用套接字。 I'd recommend socket.io http://socket.io/ 我建议使用socket.io http://socket.io/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM