Hello!
I have a little problem that I hope you can help me with:
I'm developing some PHP-classes for easier handling of sockets. In the baseclass, I've got a function to read from a specified socket. The thing is, I don't want the script to halt and wait for data when I call socket_read(), instead I want a specified callbackfunction to be called when a new line of data arrives.
Since I'm pretty new to such 'advanced' PHP-programming, the only way I figured out to do this was fork()ing the proccess, and make the child loop for data with socket_read(). But, and here comes the problem 🙂, when som data arrives, how do I transfer this data to the parent?
In all my n00biness, I got an idea to writing the data to a file and then send a SIGUSR to the parent. But isn't this really slow? Hope for help from you =)
Regards
KungdenKnege