Example #1
0
                        Debug('[Debugger]: слишком много подключений');
                    }
                }
            }
        }
        #---------------------------------------------------------------------------
        for ($ClientID = 0; $ClientID < Count($Clients); $ClientID++) {
            #-------------------------------------------------------------------------
            $Client =& $Clients[$ClientID];
            #-------------------------------------------------------------------------
            if (!Is_Resource($Client->Stream)) {
                continue;
            }
            #-------------------------------------------------------------------------
            if (In_Array($Client->Stream, $Read)) {
                #-----------------------------------------------------------------------
                $Input = @Socket_Read($Client->Stream, 64);
                #-----------------------------------------------------------------------
                if (!$Input) {
                    #---------------------------------------------------------------------
                    $Client->Disconnect();
                    #---------------------------------------------------------------------
                    Debug('[Debugger]: соединение закрыто');
                } else {
                    echo $Input;
                }
            }
        }
    }
}
#-------------------------------------------------------------------------------
 private function ReadVarInt()
 {
     $i = 0;
     $j = 0;
     while (true) {
         $k = @Socket_Read($this->Socket, 1);
         if ($k === FALSE) {
             return 0;
         }
         $k = Ord($k);
         $i |= ($k & 0x7f) << $j++ * 7;
         if ($j > 5) {
             throw new MinecraftPingException('VarInt too big');
         }
         if (($k & 0x80) != 128) {
             break;
         }
     }
     return $i;
 }