# Update



```
    /// <summary>
    /// 网络帧同步, 状态同步更新, 帧时间根据服务器主类的SyncSceneTime属性来调整速率
    /// </summary>
    public virtual void Update(IServerSendHandle<Player> handle, byte cmd = NetCmd.OperationSync)
    {
        var players = Clients;//多线程问题, 心跳 或 未知线程 添加或移除玩家时实时更新了哈希列表
        int playerCount = players.Count;
        if (playerCount <= 0)
            return;
        frame++;
        for (int i = 0; i < players.Count; i++)
            players[i]?.OnUpdate();//5000个客户端后出现null问题
        int count = operations.Count;//多线程后避免长度增加时,数据还没写入完成就会出现问题, 所以先取出写入完成的数据
        if (count > 0)
        {
            while (count > Split)
            {
                OnPacket(handle, cmd, Split);
                count -= Split;
            }
            if (count > 0)
                OnPacket(handle, cmd, count);
        }
        Event.UpdateEvent();
    }
```
