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" <[EMAIL PROTECTED]>
To: "Arnauld Dravet - smurfie" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]