[Ajuda] Server Query - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: Non-English (
https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (
https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (
https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Server Query (
/showthread.php?tid=492788)
Server Query -
JonathanFeitosa - 05.02.2014
Estou usando
esse sistema sу pra testar na hospedagem. Mas jб utilizei vбrios do fуrum para testar tambйm.
pawn Код:
/**
* Let's generate the string needed for the packet.
*/
$sIPAddr = "127.0.0.1"; // IP address of the server
$iPort = 7777; // Server port.
$sPacket = ""; // Blank string for packet.
$aIPAddr = explode('.', $sIPAddr); // Exploding the IP addr.
$sPacket .= "SAMP"; // Telling the server it is a SA-MP packet.
$sPacket .= chr($aIPAddr[0]); //
$sPacket .= chr($aIPAddr[1]); //
$sPacket .= chr($aIPAddr[2]); //
$sPacket .= chr($aIPAddr[3]); // Sending off the server IP,
$sPacket .= chr($iPort & 0xFF); //
$sPacket .= chr($iPort >> 8 & 0xFF); // Sending off the server port.
$sPacket .= 'i'; // The opcode that you want to send.
// You can now send this to the server.
/**
* Let's connect now to the server.
*/
$rSocket = fsockopen('udp://'.$sIPAddr, $iPort, $iError, $sError, 2); // Create an active socket.
fwrite($rSocket, $sPacket); // Send the packet to the server.
echo fread($rSocket, 2048); // Get the output from the server
fclose($rSocket); // Close the connection
Em principio, aqui no meu Easy PHP conectando com qualquer um servidor, funciona. Porйm, ao botar na minha hospedagem, nгo importa o IP/Porta, ele nunca responde, carrega infinitamente.
Confira o Exemplo
aqui.
Jб atualizei o PHP da hospedagem, liberei portas, verifiquei firewall, e ainda nгo corrigiu-as. A hospedagem й cpanel.
Essa coisa estб chata jб :@
Alguйm sabe o que pode ser ? Eu jб tenho noзгo que й o UDP. .-.