Re: [PHP4BETA] [Fwd: Re: select()]
| From: | Thies C. Arntzen | Date: | Tue, 23 Nov 1999 08:44:59 +0000 |
| Subject: | Re: [PHP4BETA] [Fwd: Re: select()] | ||
| References: | 1 | Groups: | php.dev php.version4 |
| Request: | Send a blank email to php-dev+get-12964@lists.php.net to get a copy of this message | ||
On Mon, 22 Nov 1999, Evan Klinger wrote:
> This is part of the conversation I had with Rasmus discussing select()
> and how to implement it. If anyone could help with regards to fetching
> the fd of a resource without knowing the resource_type, please let me
> know. Thank you.
file.c already does this. look for :
what =
zend_fetch_resource(arg1,-1,"File-Handle",&type,3,le_fopen,le_popen,le_socket);
ZEND_VERIFY_RESOURCE(what);
if (type == le_socket) {
fd = *(int *) what;
} else {
fd = fileno((FILE*) what);
}
you still need to know all the lists (le_*) where FD's are registred.
regards,
tc
>
> -------- Original Message --------
> Subject: Re: select()
> Date: Sun, 21 Nov 1999 16:04:37 -0800
> From: Evan Klinger <evan715@sirius.com>
> To: Rasmus Lerdorf <rasmus@lerdorf.on.ca>
> References: <Pine.WNT.4.21.9911211905260.-696081@lithium.jetpen.com>
>
> Rasmus Lerdorf wrote:
> >
> > > Ahh. Now I understand. But the question remains, after you are through
> > > calling FD_SET() you would call select() but select will need the fd_set
> > > variable which has the fd's stored in it. Could the fd_set struct be
> > > registered or stored somewhere and fetched be select()?
> >
> > Sure, just make it another resource.
> >
> > -Rasmus
>
> I am a little confused again. FD_SET() will be passed the resource as
> returned by, say, fsockopen(). FD_SET() will need to fetch the actual fd
> associated with the resource with ZEND_FETCH_RESOURCE() which leads us
> back to square one.
> --
>
> ev
>
> ----------------------------
> Evan Klinger evan@php.net
> AIM evan715
>
> --
> PHP 4.0 Beta Mailing List <http://www.php.net/version4/>
> To unsubscribe, e-mail: php4beta-unsubscribe@lists.php.net
> For additional commands, e-mail: php4beta-help@lists.php.net
> To contact the list administrators, e-mail: php4beta-admin@lists.php.net
>
>
Thies C. Arntzen "One Big-Mac, Small Fries and a Coke!"
Digital Collections Phone +49 40 235350 Fax +49 40 23535180
Hammerbrookstr. 93 20097 Hamburg / Germany