Connecting to a TCP client device with IE8

I have been investigating different paperless solutions for customer and employee forms. I wanted something cross platform and extensible. I settled on using one of the common payment terminals as a signature capture device. As a bonus the mag stripe reader could be used to enter customer credit card data into our software.

The two models I worked with are the VeriFone Mx860 and the Equinox (formerly HyperComm) L5300. Both devices support much more functionality than I was interested in. Linux is the OS used on each and there are several connection options. I configured each device as a TCP client and attempted to communicate with the devices.

Of the two, the VeriFone has better documentation. It also was easier to muddle my way through the initial communication. I did find some small errors in the Equinox protocol documentation, but the most annoying thing about it was the ACK responses I got to invalid packets. It appeared that correct information was passed because of the ACK, but the device would ignore the command sent. Once I figured that out, I had basic code up and runningrather quickly.

The devices are rather similar in features, but the Equinox has a large, gorgeous color screen.

This is how I am simulating real time communication from the device (configured as a TCP client) to an IE8 computer. When a button is selected on the device it appears in real time in the web page. There must be an intermediary between the IE8 computer and the TCP client device. I chose to use the webserver.

The key is some code that can communicate with both the web browser and the terminal. I wrote two versions, one in PHP and one in C#. I would recommend a compiled language, but Python may work well also.

My code listens on one port for a connection from the terminal and then relays data in HTTP to JavaScript on the web page. Even though my web browser connects to the web server and my code on the same IP, the use of two port numbers requires Cross Origin Resource Sharing (CORS) HTTP headers be sent by my code.

Another key piece was a jQuery plugin that allowed me to use new XDR request object in IE8. The older XHR does not allow CORS requests.