feat: 实现TCP Server

This commit is contained in:
zimoyin
2026-03-02 21:59:43 +08:00
parent 043306819b
commit a79dfae57d
144 changed files with 15785 additions and 140 deletions
+41
View File
@@ -0,0 +1,41 @@
<?php
namespace app\net;
use Workerman\Connection\TcpConnection;
class PacketContext
{
public $connections {
get => $this->connections;
}
public TcpConnection $connection {
get => $this->connection;
}
public Packet $packet {
get => $this->packet;
}
public string $ip {
get => $this->connection->getRemoteIp();
}
public int $port {
get => $this->connection->getRemotePort();
}
/**
* @var int 上下文创建时的时间
*/
public int $createTime {
get {
return time();
}
}
public function __construct(array $connections,TcpConnection $connection, Packet $packet)
{
$this->connections = $connections;
$this->connection = $connection;
$this->packet = $packet;
}
}