如何从网页中的串口读取内容

发布于 2024-09-11 03:47:16 字数 541 浏览 4 评论 0原文

我想设计一个网络表单,用户应该填写一些字段。一个字段的值应从客户端计算机的串行端口(COM1)读取,该客户端计算机连接有特殊硬件,并且用户在填写表格时按硬件的发送到PC键。

我如何监听网页中的COM1端口并获取COM1的值并将其自动放置在Web表单中?

我听说 ActiveX 控件可以做到这一点,但它只与 IE 兼容(对吗?)。另一种选择是 Java 小程序。

我想要一个与(至少)IE/Firefox/Opera 兼容的简单解决方案。

在服务器端,我可以使用 ASP 或 PHP,但如果您为每个提供解决方案,我将不胜感激。

更新:

我们可以告诉客户更改其安全设置以接受我们的 ActiveX/小程序。

我们还可以告诉客户安装一个作为服务运行并从串行端口读取的自定义程序。

问题是读取的数据应该立即自动输入到网络表单中。

java applet是个好主意,但是客户端必须安装JRE,JRE体积很大。

还有其他选择吗?

I want to design a webform that user should fill some fields. The value of one field should be read from Serial port (COM1) of client computer which a special hardware is connected to it and the user presses the Send to PC key of the hardware when filling the form.

How i can listen to COM1 port in my webpage and get the value of COM1 and place it in the web form automatically?

I heard that ActiveX controls can do this but it is compatible only with IE (right?). The other option is Java applets.

I want a simple solution which be compatible with (at least) IE/Firefox/Opera.

I the server-side i can have ASP or PHP but i am appreciate if you give a solution for each.

UPDATE:

We can tell clients to change their security settings to accept our ActiveX/applet.

It is also possible for us to tell clients to install a custom program which runs as a service and reads from Serial port.

The problem is the read data should be entered to the webform automatically and immediately.

The java applet is a good idea, but the client have to install JRE which is large in size.

Is there any other option?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

淡淡離愁欲言轉身 2024-09-18 03:47:16

我正在解决同样的问题并且我做到了。它是使用 Java Web Applet 完成的。您将需要 NetBeans。首先阅读“自述文件”。如果有的话请告诉我。

http://racky.wz.cz/applet_rs232.zip

专为串行 COM1 设计。插入 RS-232 电缆并短接(连接)另一端的引脚 2 和 3。

I was solving the same problem and I did it. It is done using a Java Web Applet. You will need NetBeans. Read "readme" first. Let me know if anything, pls.

http://racky.wz.cz/applet_rs232.zip

Designed for serial COM1. Plug in it a RS-232 cable and short (connect) pins 2 and 3 on the other end.

合久必婚 2024-09-18 03:47:16

使用 Java Applet,您可以从串行端口读取数据,但出于安全原因,您需要对 Applet 进行签名。要非官方公司(没有太阳公司),您必须创建一个证书。 这里是一个示例。

With a Java Applet you can read from the serial port but you need to sign the applet for security reasons. To firm unofficially (no sun's firm) you have to create a certificate. Here is an example.

最美的太阳 2024-09-18 03:47:16

这似乎会破坏大多数网络安全模型。我想不出一种可以在浏览器中执行而不授予小程序或 ActiveX 控件大量权限的方法(即使如此,我也不确定这是否可行)。我认为可能需要某种本机“厚”客户端应用程序来与串行端口进行通信。

This would appear to break most security models for the web. I cannot think of a way that it would be possible to do within a browser without granting an applet or ActiveX control a whole lot of permissions (and even then I'm not certain it's possible). I think it's likely to require some kind of native "thick" client-side application to do the communication with the serial port.

瞎闹 2024-09-18 03:47:16

Java 很可能是维护跨浏览器和跨平台兼容性的最佳选择。快速搜索后,您可能会发现这些有用的页面:

服务器端的选择根本不重要。客户端读取数据后,与将任何其他数据发送到服务器端脚本相同。

Java might very well be your best choice for maintaining cross-browser and cross-platform compatibility. A quick search brought up these pages that you may find useful:

The server-side choice doesn't matter at all. Once the client reads the data, it's the same as sending any other data to a server-side script.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文