Source

pecl-ev / TODO

Start watchers automatically by default
=======================================
In most cases watchers are started automatically.
Getting rid of need to call ::start() method we skip the function call overhead!.


Remove $loop arg from watcher class constructors, assume the default loop used.
Make EvLoop methods for creating watchers based on special loop.
===============================================================================


libevent buffer functionality?
=============================

	<?php
	ini_set('display_errors', 'On');
	error_reporting(-1);
	$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
	socket_set_nonblock($socket);
	socket_connect($socket, 'phpdaemon.net', 843);
	$eventBase = event_base_new();
	$buffer = event_buffer_new(
        	$socket,
        	function ($stream, $arg) use (&$buffer) {
                	echo "Read\n";
                	var_dump(event_buffer_read($buffer, 1024));
        	},
        	function ($stream, $arg) use (&$buffer)  {
                	echo "Write\n";
                	static $first = true;
                	if ($first) {
                        	event_buffer_write($buffer, "<policy-file-request/>\x00");
                        	$first = false;
                	}
        	},
        	function ($stream, $arg)  use (&$buffer)  {
                	echo "failure\n";
        	}
	);
 	 
	event_buffer_base_set($buffer, $eventBase);
	event_buffer_enable($buffer, EV_READ | EV_WRITE | EV_TIMEOUT | EV_PERSIST);
	event_base_loop($eventBase);

SAMPLE OUTPUT
------

	[root@gf-home-server phpdaemon]# php -q test.php

	Warning: socket_connect(): unable to connect [115]: Operation now in progress in /home/web/phpdaemon/test.php on line 6
	Write
	Write
	Read
	string(268) "<?xml version="1.0"?>
	<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
	<cross-domain-policy>
 	 <allow-access-from domain="*" to-ports="*"/>
 	 <site-control permitted-cross-domain-policies="all"/>
	</cross-domain-policy>
	"
	failure
	[root@gf-home-server phpdaemon]# php -q test.php

	Warning: socket_connect(): unable to connect [115]: Operation now in progress in /home/web/phpdaemon/test.php on line 6
	Write
	Write
	Read
	string(268) "<?xml version="1.0"?>
	<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
	<cross-domain-policy>
 	 <allow-access-from domain="*" to-ports="*"/>
 	 <site-control permitted-cross-domain-policies="all"/>
	</cross-domain-policy>
	"
	failure
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.