sun's longitude:30 44 17 
¡¤ ÀÚÀ¯°Ô½ÃÆÇ ¡¤ ¹¯°í´äÇϱ⠡¤ ¾ËÆĹ®¼­ ¡¤ RPMS list
¡¤ »ç¿ëÀÚ¹®¼­ ¡¤ ÆÁ/FAQ¸ðÀ½ ¡¤ ¸®´ª½ºLinks ¡¤ ÀÚ·á½Ç
¡¤ ¼­¹öÁ¤º¸ ¡¤ ¿î¿µÀÚ ¡¤ Books/FAQ ¡¤ FreeBSD
 
/board/read.php:¼Ò½ºº¸±â   
 
¾ËÆĹ®¼­
ÀÚÁÖ Àؾî¸Ô°Å³ª, ¸Þ¸ðÇØ µÑ Çʿ伺ÀÌ ÀÖ´Â ÆÁÀ̳ª ¹®¼­, ±âŸ µîµî
[*** ¾²±â ±ÝÁö´Ü¾î ÆÐÅÏ ***]
±Û º»¹® Áß°£¿¡ ¾÷·ÎµåÇÒ À̹ÌÁö¸¦ Ãß°¡ÇÏ´Â ¹æ¹ý : @@À̹ÌÁöÀ̸§@@
ex) @@foo.gif@@
196 ¹ø ±Û: [PHP] imitative Async I/O non-block exec
±Û¾´ÀÌ: »êÀÌ [ȨÆäÀÌÁö] ±Û¾´³¯: 2009³â 02¿ù 03ÀÏ 13:58:37 È­(¿ÀÈÄ) Á¶È¸: 3158
## Async I/O Èä³»³»±â
-------------------------------
<?php
##
## -- san2@2009.02.03
## -- imitative Async I/O non-block execution


## imitative Async I/O run execution
$proc[] = popen('sh ss.sh 8 2>&1','r');
$proc[] = popen('sh ss.sh 10 2>&1','r');
$proc[] = popen('sh ss.sh 20 2>&1','r');

## none-block
foreach($proc AS $fp)
{
  stream_set_blocking($fp,0);
  $stream[] = $fp;
}
print_r($stream);

while($read = $stream)
{
  if(stream_select($read,$w=NULL,$e=NULL,0,500000) === FALSE) continue;
  foreach($read AS $fp)
  {
	//while($buf = fgets($fp,512)) echo $buf;
	fpassthru($fp);
	if(feof($fp))
	{
		$key = array_search($fp,$stream);
		unset($stream[$key]);
		fclose($fp);
	}
  }
}
exit;
?>
-------------------------------
<?php
## -- san2@2009.02.03
## -- imitative Async I/O non-block execution

## 0=>stdin, 1=>stdout, 2=>stderr
$desp = array(0=>array('pipe','r'), 1=>array('pipe','w'), 2=>array('pipe','w'));

## imitative Async I/O run execution
$proc[] = proc_open('sh ss.sh 8',$desp,$p[]);
$proc[] = proc_open('sh ss.sh 10',$desp,$p[]);
$proc[] = proc_open('sh ss.sh 20',$desp,$p[]);

## set non-block
foreach($p AS $fp)
{
  fclose($fp[0]);
  stream_set_blocking($fp[1],0);
  $stream[] = $fp[1];
}
print_r($stream);

while($read = $stream)
{
  if(stream_select($read,$w=NULL,$e=NULL,0,500000) === FALSE) continue;
  foreach($read AS $fp)
  {
	//while($buf = fgets($fp,512)) echo $buf;
	fpassthru($fp);
	if(feof($fp))
	{
		$key = array_search($fp,$stream);
		unset($stream[$key]);
		fclose($fp);
		fclose($p[$key][2]);
		proc_close($proc[$key]);
	}
  }
}
exit;
?>
-------------------------------
<?php
## -- san2@2009.02.03
## -- imitative Async I/O non-block execution, simple but not good

## 0=>stdin, 1=>stdout, 2=>stderr
$desp = array(0=>array('pipe','r'), 1=>array('pipe','w'), 2=>array('pipe','w'));

## imitative Async I/O run execution
$proc = proc_open('/bin/sh -i',$desp,$fp); // zombie

## set non-block
stream_set_blocking($fp[0],0);
stream_set_blocking($fp[1],0);

fwrite($fp[0],'/bin/sh ss.sh 12 2>&1 &');
fwrite($fp[0],'/bin/sh ss.sh  8 2>&1 &');
fwrite($fp[0],'/bin/sh ss.sh 20 2>&1 &');
fclose($fp[0]);

$stream = array($fp[1]);
while(1)
{
  if(stream_select($stream,$w=NULL,$e=NULL,0,500000) === FALSE) continue;
  while($buf = fgets($fp[1],512)) echo $buf;
  //fpassthru($fp[1]);
  if(feof($fp[1]))
  {
        fclose($fp[1]);
        fclose($fp[2]);
        proc_close($proc);
        break;
  }
}
exit;
?>
-----------------------------------------

 
ÀÌÀü±Û : [apache2.2] ¸ðµâ ¼³Ä¡
´ÙÀ½±Û : [PHP] socket_connect_status  
 from 114.111.62.248
JS(Redhands)Board 0.4 +@

|±Û¾²±â| |´äÀå¾²±â| |¼öÁ¤| |»èÁ¦|
|ÀÌÀü±Û| |´ÙÀ½±Û| |¸ñ·Ïº¸±â|
Àμâ¿ë 

apache lighttpd linuxchannel.net 
Copyright 1997-2024. linuxchannel.net. All rights reserved.

Page loading: 0.02(server) + (network) + (browser) seconds