ID: 13122
Updated by: sniper
Reported By: [EMAIL PROTECTED]
Old Status: Open
Status: Closed
Bug Type: Sockets related
Operating System: linux red hat 7.1
PHP Version: 4.0.4pl1
New Comment:

You fread() instead which is binary safe.

--Jani



Previous Comments:
------------------------------------------------------------------------

[2001-09-04 04:38:25] [EMAIL PROTECTED]

well when i send an UDP packet to my halflife server with 
fsockopen and fgets, it returns me another packet beginning from the 2nd line instead 
of the 1st. it means that if i were supposed to get :

packet #1-"hello"
packet #2-"world"
packet #3-"its me"

i receive :

packet #1-"world"
packet #2-"its me"


here's a sample of my code :
//---------------------------------------------------------

function get_pass_player_cs($serverip,$port,$rcon)
{

        $get_pass_player_cs .= "<BR>Do ".$commande." on 
:".$serverip.":".$port.'<BR><BR>';

        //Open the network for transmission. 
        $serverip = "udp://".$serverip;
        $fp = fsockopen($serverip,$port, &$errno, &$errstr,10);
        if (!$fp) 
        { 
                $get_pass_player_cs .= "Server not available :".$errno;
        } 
        else 
        { 
                //Send statusrequest. 
                fwrite($fp,"˙˙˙˙challenge rcon"."\x00");
                $challenge = fgets($fp,50);
                $challenge = substr($challenge, 19);
                $challenge = trim ($challenge);
                $rcontxt="˙˙˙˙rcon ".$challenge." ".$rcon." status\x00";
                fwrite($fp,$rcontxt);

                $tmp = fgets($fp,100);
//debug         echo $tmp;
                
                $get_pass_player_cs = $tmp;
                
                fclose($fp);
                return $get_pass_player_cs;
        }
        $get_pass_player_cs .= "Erreur";
        fclose($fp);
        return $get_pass_player_cs;
}
//---------------------------------------------------------

------------------------------------------------------------------------



Edit this bug report at http://bugs.php.net/?id=13122&edit=1


-- 
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]

Reply via email to