package name suggestions?
| From: | (Stig Sæther Bakken) | Date: | Sat, 25 Aug 2001 08:12:40 +0000 |
| Subject: | package name suggestions? | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-1692@lists.php.net to get a copy of this message | ||
Hi,
I'm writing a package for doing background socket IO with ticks. I'm
going to prototype it in PHP and rewrite to C when the API is hammered
out. Here's an example of use:
// verbose example, to let you know what's going on:
$fp = fsockopen("www.php.net", 80);
fwrite($fp, "GET / HTTP/1.0\r\nHost: www.php.net\r\n\r\n");
$bg = IO_Background::register($fp, IO_BACKGROUND_BUFFER);
declare (ticks = 5) {
// your regular code goes here, and your tick function
// buffers up socket output, until...
// ...whoops! now we really need the data from that
// socket:
$bg->finish();
print $bg->fetchBuffer();
}
The IO_BACKGROUND_BUFFER constant is just one of several modes it can
have. This one simply stores all the output in memory until you fetch
it. There will also be a "line read callback mode", "block read
callback mode" and maybe something fancy matching regexps in the last
read block/line or the entire buffer before doing the callback.
Letting people register their own read methods would be nice, too.
Anyway, I'd like some help in choosing a name for it. Here are my
ideas so far:
IO_Background (purpose specific)
IO_Ticked (more implementation specific)
IO_Bg (shorter, but obscure)
IO_Async (leaves room for future expansion :)
(I'm thinking "IO" instead of "Socket" because it may just as well be
used for regular files or popen file descriptors too, if PHP ever
supports asynchronous reads from such.)
- Stig
--
Stig Sæther Bakken <ssb@alltheweb.com>
Fast Search & Transfer ASA, Trondheim, Norway