views:

221

answers:

5

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?

+1  A: 

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.

Gian
Our clients have no problem with granting such permissions to the applet. I've also updated the question for clarification.
Isaac
A: 

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.

casablanca
This will however require a fat client since it can not be done from an applet due to the security restrictions.
Chris
+1  A: 

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.

Victor Marzo
A: 

May I know how read/write from com port in a webpage? Got any solution or sample code? if using applet, can provide the sample code? My problem is now I got a website, but do know how to read/write the com port at client pc from the website.Can anyone provide me the solution?

This is not how you should use SO. Feel free to ask your own question (and, if relevant, link to this question) but please use the "answer" feature to provide answers only :)
jensgram
A: 

Hello. 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.

Racky