How can I read from a file in PHP without waiting for a response?

edskee

New member
I have a script that reads data from a file (actually a /dev device - its input coming into a USB controller) and it works great. However, if theres no data to read, I need the program to do other stuff... basically it's a loop... read? If data there, process it and continue. If not, do some other stuff. Then loop.

Problem is when I read from the file, the program pauses, and waits for data to come before continuing.

I need it to read, if nothing there, continue on...

Anyone know how I can accomplish this?
I'm doing a fread... you mention "testing the device" before issuing the read. What do you mean and how would I do that?
Regarding: "My question is more: how do you have something connected on a USB port on a "normal" server? (Unless you have made your machine a server, in which case, your code will only work on your machine, NOT on a public server)."

I'm not 100% sure what you're talking about. A "normal" server? USB device attached to my computer, running PHP on it... whats the "normal" and "public" server have to do with anything?
 
Back
Top