سؤال

I want to communicate 2 process using FIFOS. One process is writting in C and the other in PHP. The problem is that if I use FIFOS, the writer blocks until the reader open the FIFO, and the same in the other direction. I explain it better, I have a PHP process that recieve xml request. The PHP take the xml and send it to the FIFO1(conecting with the C process). The C process read the FIFO1 takes the xml do some stuff and send the response to the FIFO2(connecting with the PHP). I want to do it in non-block. I mean, if the PHP process cannot read anything from the FIFO2 it no blocks and it can receive xml request meanwhile. If there is someone interested I can post my code here.

Thanks ;).

هل كانت مفيدة؟

المحلول

You can set a stream to non-blocking in PHP.

$resource = fopen('...', 'r');
stream_set_blocking($resource, 0);
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top