🆙 More fixes 🆙

This commit is contained in:
Remco
2026-01-19 17:32:44 +01:00
parent 3f9e928952
commit 521f9c884c
6 changed files with 46 additions and 30 deletions
+14 -4
View File
@@ -12,7 +12,7 @@ class RconService
{
protected ?Socket $socket = null;
public bool $isConnected = false;
public private(set) bool $isConnected = false;
protected array $config = [];
@@ -28,7 +28,7 @@ class RconService
private function initialize(): void
{
$this->socket = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
$this->socket = @socket_create(domain: AF_INET, type: SOCK_STREAM, protocol: SOL_TCP);
if (! $this->socket) {
$error = socket_strerror(socket_last_error());
@@ -39,8 +39,18 @@ class RconService
return;
}
socket_set_option($this->socket, SOL_SOCKET, SO_RCVTIMEO, ['sec' => 5, 'usec' => 0]);
socket_set_option($this->socket, SOL_SOCKET, SO_SNDTIMEO, ['sec' => 5, 'usec' => 0]);
socket_set_option(
socket: $this->socket,
level: SOL_SOCKET,
option: SO_RCVTIMEO,
value: ['sec' => 5, 'usec' => 0]
);
socket_set_option(
socket: $this->socket,
level: SOL_SOCKET,
option: SO_SNDTIMEO,
value: ['sec' => 5, 'usec' => 0]
);
if (! @socket_connect($this->socket, $this->config['ip'], $this->config['port'])) {
$error = socket_strerror(socket_last_error());