Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
364 views
in Technique[技术] by (71.8m points)

hardware - How to read from Serial port in a webpage

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...