示例#1
0
    //-----------------------------------------------------------------------------------------
    private void ManageReliable(IPEndPoint source, NetMessage nm)
    {
        UInt32 id       = nm.PopUInt32();
        int    sourceHC = source.GetHashCode();

        NetMessage tmp = new NetMessage();

        tmp.Push(sourceHC);
        tmp.Push(id);
        UInt64 id64 = tmp.PopUInt64();

        if (alreadyReceived.Contains(id64))
        {
            return;
        }

        tmp.Push(sourceHC);
        tmp.Push(id - 1000);
        UInt64 id641k = tmp.PopUInt64();

        if (alreadyReceived.Contains(id641k))
        {
            alreadyReceived.Remove(id641k);                                  //Only keep 1000 messages in pool
        }
        alreadyReceived.Add(id64);

        tmp = new NetMessage();
        tmp.Push((byte)RU_MessageType.ACK);
        tmp.Push(id);
        _socket.BeginSend(tmp.ToArray(), tmp.GetLength(), source, new AsyncCallback(SentCallback), _socket);

        NetMessage tmp2 = new NetMessage(nm, 5);

        OnMessageReceivedAsync(source, tmp2, true);
    }
示例#2
0
    //-----------------------------------------------------------------------------------------
    private void ManageAck(NetMessage nm)
    {
        UInt32 nmID = nm.PopUInt32();

        RemoveRUMessage(nmID);
    }