|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-08-24 00:00 UTC] jason@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 09:00:01 2025 UTC |
I work with the pcntl extension and sockets, and I'm working on the developpement of a multiuser server. Several clients can connect limited to FD_SIZE. I start by a setup : //Setup of the sockets .... //Setup of the client array $i=0; while($i<FD_SETSIZE){ $client[$i]=null; $i++; } while(1){ Here the parent cheks connection $new_socket=socket_accept(main_socket); It accepts and puts the new socket ressource in the first free slot of the array client .... $client[$k]=$new_socket ..... if(!pcntl_fork){ Child here..... Manage the dialog its OK ! with several connection .... but when I shutdown a connection, exit is correct ... I need to remove the linked ressources from $client[$slot] and it is the same for the select array... So I do $client[$slot]=null; .... But It seems to fail, and each time the parent continues to see the allocate ressources, so it refuses more connexion, because $client[$slot] is not change from the parent point of view. }//En child }// Where I'm wrong, is there a bug for variables between parent and child ? Or maybe I make a confusion for the way to remove ressources from my client array (value or references) ? So, now I'm lost, Could somebody gives me some help about please ? I can send all the code if necessary ! Thanks for your help Marcel