/// <summary>
    /// tính crc với mục đích kiểm tra sự đồng bộ hóa
    /// </summary>
    private UInt32 ComputeCRC()
    {
        OutputMemoryBitStream output = new OutputMemoryBitStream();

        foreach (var pair in mNetworkIdToGameobjectDic)
        {
            NetworkObject mObject = pair.Value.GetComponent <NetworkObject>();
            if (mObject != null)
            {
                mObject.WriteForCrc(ref output);
            }
        }

        UInt32 re = Crc32.Compute(output.GetBuffer(), 0, output.GetByteLength());

        return(re);
    }
 private void Send_nonblocking(OutputMemoryBitStream output, EndPoint to)
 {
     if (mSocket == null)
     {
         return;
     }
     if (Disconnected)
     {
         return;
     }
     try
     {
         mSocket.BeginSendTo(output.GetBuffer(), 0, output.GetByteLength(), SocketFlags.None, to, new AsyncCallback(sendto_callback), null);
     }
     catch (ObjectDisposedException ex)
     {
         Debug.Log("socket has been closed");
         return;
     }
 }
 private void Send_thread(OutputMemoryBitStream output, EndPoint to)
 {
     byte[] newData = new byte[output.GetByteLength()];
     Array.Copy(output.GetBuffer(), newData, output.GetByteLength());
     mSocket.SendTo(newData, to);
 }