<commit_before><?php
/**
 * This code is free software; you can redistribute it and/or modify it under
 * the terms of the new BSD License.
 *
 * Copyright (c) 2008-2009, <NAME>
 *
 * @author     <NAME>
 * @license    http://www.opensource.org/licenses/bsd-license.php New BSD License
 * @package    Steam Condenser (PHP)
 * @subpackage Sockets
 */

require_once "InetAddress.php";
require_once "SocketChannel.php";
require_once "exceptions/RCONBanException.php";
require_once "exceptions/PacketFormatException.php";
require_once "steam/packets/rcon/RCONPacket.php";
require_once "steam/packets/rcon/RCONPacketFactory.php";
require_once "steam/sockets/SteamSocket.php";

/**
 * @package    Steam Condenser (PHP)
 * @subpackage Sockets
 */
class RCONSocket extends SteamSocket {
    public function __construct(InetAddress $ipAddress, $portNumber) {
        parent::__construct($ipAddress, $portNumber);

        $this->buffer = ByteBuffer::allocate(1400);
        $this->channel = SocketChannel::open();
        $this->remoteSocket = array($ipAddress, $portNumber);
    }

    public function send(RCONPacket $dataPacket) {
        if(!$this->channel->isConnected()) {
            $this->channel->connect($this->remoteSocket[0], $this->remoteSocket[1]);
        }

        $this->buffer = ByteBuffer::wrap($dataPacket->getBytes());
        $this->channel->write($this->buffer);
    }

    public function getReply() {
        if($this->receivePacket(1440) == 0) {
            throw new RCONBanException();
        }
        $packetData = substr($this->buffer->_array(), 0, $this->buffer->limit());
        $packetSize = $this->buffer->getLong() + 4;

        if($packetSize > 1440) {
            $remainingBytes = $packetSize - 1440;
            do {
                if($remainingBytes < 1440) {
                    $this->receivePacket($remainingBytes);
                }<commit_msg>Fixed problems with reduced MTU<commit_after><?php
/**
 * This code is free software; you can redistribute it and/or modify it under
 * the terms of the new BSD License.
 *
 * Copyright (c) 2008-2009, <NAME>
 *
 * @author     <NAME>
 * @license    http://www.opensource.org/licenses/bsd-license.php New BSD License
 * @package    Steam Condenser (PHP)
 * @subpackage Sockets
 */

require_once "InetAddress.php";
require_once "SocketChannel.php";
require_once "exceptions/RCONBanException.php";
require_once "exceptions/PacketFormatException.php";
require_once "steam/packets/rcon/RCONPacket.php";
require_once "steam/packets/rcon/RCONPacketFactory.php";
require_once "steam/sockets/SteamSocket.php";

/**
 * @package    Steam Condenser (PHP)
 * @subpackage Sockets
 */
class RCONSocket extends SteamSocket {
    public function __construct(InetAddress $ipAddress, $portNumber) {
        parent::__construct($ipAddress, $portNumber);

        $this->buffer = ByteBuffer::allocate(1400);
        $this->channel = SocketChannel::open();
        $this->remoteSocket = array($ipAddress, $portNumber);
    }

    public function send(RCONPacket $dataPacket) {
        if(!$this->channel->isConnected()) {
            $this->channel->connect($this->remoteSocket[0], $this->remoteSocket[1]);
        }

        $this->buffer = ByteBuffer::wrap($dataPacket->getBytes());
        $this->channel->write($this->buffer);
    }

    public function getReply() {
        if($this->receivePacket(1440) == 0) {
            throw new RCONBanException();
        }
        $packetData = substr($this->buffer->_array(), 0, $this->buffer->limit());
        $packetSize = $this->buffer->getLong() + 4;

        if($packetSize > 1440) {
            $remainingBytes = $packetSize - $this->buffer->limit();
            do {
                if($remainingBytes < 1440) {
                    $this->receivePacket($remainingBytes);
                }
{'fraction_non_alphanumeric': 0.14484752891692954, 'fraction_numerical': 0.01629863301787592, 'mean_word_length': 3.087003222341568, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 55, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '950160', 'n_tokens_mistral': 1187, 'n_tokens_neox': 1120, 'n_words': 224}