Counter-Strike/cli/adBot.php
Daniel Maixner a74ab89951 Perf tuning
lets hope for better jit
2022-12-22 16:07:51 +01:00

23 lines
459 B
PHP

<?php
use Socket\Raw\Factory;
require __DIR__ . '/../vendor/autoload.php';
/////
$loginCode = ($argv[1] ?? 'acode');
$port = (int)($argv[2] ?? 8080);
$address = "udp://localhost:$port";
/////
$factory = new Factory();
$socket = $factory->createClient($address, 4);
$socket->write('login ' . $loginCode);
$bool = true;
while (true) { // @phpstan-ignore-line
$socket->read(10241024);
$socket->write($bool ? 'left' : 'right');
$bool = !$bool;
}