Re: sockets issues ?

From: Date: Thu, 26 Jul 2001 22:09:04 +0000
Subject: Re: sockets issues ?
References: 1 2  Groups: php.dev 
Request: Send a blank email to php-dev+get-61117@lists.php.net to get a copy of this message
Hello Leo, Thanks for your reply, because i really need that script to be made ... Okay i made a typo where you noticed it, it should be == not =. (actually it doesn't really change anything to my problem :( ) What i don't understand is why the first call: > > $sock_tab = socket_get_status($sock); > > if ($sock_tab["unread_bytes"] >= 0) is evaluated to >=0 (it enters the loop and try to read the socket) the funny thing is that all the output made on the web page is: Reading from the socket: (0 bytes left in the socket buffer) <-- why did he enter the loop if $sock_tab["unread_bytes"] == 0 ?? #7#-,Smurfie,18,swordsman,"i died in the luggies dungeon near Mayoi, need corpse recovery",UnAck#7#-,smurfie,18,swordsman,"truc <-- informations fgets received via the socket Reading from the socket: (71 bytes left in the socket buffer) <-- socket_get_status detected there are some data on the socket so we re-entered the loop bidule",UnAck#7#-,"smurfie","18","swordsman","truc bidule","UnAck" <-- we receive the 2nd part of the informations which were not complete because of the 128bytes limited fgets and there PHP hangs, browser keep waiting for the end of the page ... what troubles did you have with 4.0.6 and how did you fix it ? Thanks again Arnauld ----- Original Message ----- From: "Leo" <lwest@afp.com> To: "Arnauld Dravet - smurfie" <smurfie@artefact21.net>; <php-dev@lists.php.net> Sent: Thursday, July 26, 2001 7:06 PM Subject: Re: [PHP-DEV] sockets issues ? > On Thursday 26 July 2001 18:06, Arnauld Dravet - smurfie wrote: > > > > Then i tried that: > > $sock_tab = socket_get_status($sock); > > if ($sock_tab["unread_bytes"] >= 0) > > { > > $a_lire = true; > > while ($a_lire) > > { > > $bytes_left = $sock_tab["unread_bytes"]; > > print("<br>Reading from the socket: ($bytes_left bytes left in the > > socket buffer) <br>"); > > $buffer = fgets($sock, 128); > > print("$buffer"); > > flush(); > > $buffer=""; > > $sock_tab = socket_get_status($sock); > > if ($sock_tab["unread_bytes"] = 0) $a_lire = false; > > missing = here: > if ($sock_tab["unread_bytes"] == 0) $a_lire = false; > > > } > > print("$buffer<br>"); > > } > > else print("<br>No informations received on the socket.<br>"); > > > > On the other hand, i've also encountered misc. socket problems in 4.0.6. > > --Leo > > -- > PHP Development Mailing List <http://www.php.net/> > To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net > For additional commands, e-mail: php-dev-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.dev (#61117) next »