Copy link to clipboard
Copied
I have a magnetic stripe reader that sits on the network at IP address xx.xx.xx.x
When a badge is scanned, I want that information to go straight to a database as if entered on a keyboard.
I have this working fine with a keyboard wedge style scanner, but need to capture the scan from an IP based scanner instead. At issue is the fact that when using the keyboard wedge scanner, the end user is already on my CF page. What I want to do is have CF MONITOR an IP address.
How can I tell CF to receive input from my network IP address?
Copy link to clipboard
Copied
I suspect you would need to write, or use a third party's, event gateway.
http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec22c24-7d9c.html
Message was edited by: JR "Bob" Dobbs
Copy link to clipboard
Copied
You might take a look at the SocketGateway.
http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec22c24-77f7.html
Copy link to clipboard
Copied
Now that I think about it, I might not even need to use CF. What I need is the abillity to log the scan into my SQL database, and just display the info from the database. No point in getting CF involved if I dont have to.
The way it works "out of the box" is that a telnet session needs to be running somewhere on the network. It monitors the IP / Port in question for activity and writes the scan to a simple text file. I just need to figure out how to change it so the telnet session writes to my DB rather than to a text file.
My original thought was to have CF monitor and maintain a telnet session, but that may be unnecessary if I can find another way to get the data into SQL Server directly.
Copy link to clipboard
Copied
I changed course a bit, but I am not totally happy with the solution.
The scanner logs the collected data to a text file (a CSV)
When a visitor hits my web page, it reads the CSV file, loops through it and inserts the data into SQL Server.
The program then deletes the CSV file completely.
The program then recreates the CSV file with just the headers.
The very next scan after a page view always goes into an empty table.
Not sure what will happen when the timing overlaps. We shall see.
Copy link to clipboard
Copied
It sounds like the scanner can't put the data directly in the database, huh? That being the case, your approach sounds pretty good but note that you don't have to wait for someone to hit the page: you can use the DirectoryWatcherGateway, you can create your own event gateway, you can use a scheduled task, or you can even do it all in code by using asynchronous threads.
Copy link to clipboard
Copied
I realize I can use the other options, but I dont see any point in using up cycles and resources when there
very well may be nothing new in the interim.
So, my philosoply is, when somene is interested enough to look at the web page, I will poll the text file to see if there is anything new.