Re: cvs socket extension

From: Date: Mon, 23 Jul 2001 14:19:25 +0000
Subject: Re: cvs socket extension
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-60757@lists.php.net to get a copy of this message
On Mon, Jul 23, 2001 at 03:10:12PM +0200, Daniel Beulshausen wrote : > At 05:14 23.07.2001 -0700, Chris Vandomelen wrote: > > > Morning ... > > > > > > Has anyone a working example on using the new socket_select() > > > call with non-blocking connection-oriented sockets? blocking > > > sockets with socket_accept() work like a charm. But I can't get > > > socket_select() to work. > > > >That's because of the patches that were made. Try specifying 0x7FFFFFFF or > >something equally large for max_fd (the first argument to select) and it > >*should* work. > > > >The reason it doesn't work is because file descriptors were changed from > >ints to resources, and since the first argument to select() (and therefore > >socket_select()) must be greater than the largest file descriptor in the > >set, and resource number != file descriptor.. should be obvious. :) > > > >Try something like: > > > >-------------------------- > >$someport = 3334; > > > >$fd = socket_create_listen($someport, 5); > > > >$fd_set = socket_fd_alloc(); > >socket_fd_set($fd, $fd_set); > > > >socket_select(0x7fffffff, $fd_set, 0, 0, 0, 0); > > we can add a support function which return's the php_socket->socket integer. Glad someone came up with this. Since socket_select() always wants highest +1, couldn't this be implemented into socket_select() to go through all socket sets and get the number itself ? Or are there good reasons to let the user specify the value on its own ? - Markus

« previous php.dev (#60757) next »