Exemple #1
0
        protected virtual void replyHandler_Google <TSource>(object sender, TcpIpEventArgs e, ref TSource inStr)
            where TSource : IMessage <TSource>
        {
            int threadID = System.Threading.Thread.CurrentThread.ManagedThreadId;

            lock (handlerLock)
            {
                try
                {
                    if (hasRtn)
                    {
                        return;
                    }

                    int iSeqNum = getMsgNumByGoogleMessage(inStr);

                    if (iSeqNum != e.iSeqNum)
                    {
                        return;
                    }

                    recvStr = e.objPacket;
                    hasRtn  = true;
                }
                catch (Exception ex)
                {
                    //todo recode log
                }
            }
        }
Exemple #2
0
        protected virtual void replyHandler <TSource, TSource2>(object sender, TcpIpEventArgs e, ref TSource inStr)
        {
            int threadID = System.Threading.Thread.CurrentThread.ManagedThreadId;

            lock (handlerLock)
            {
                try
                {
                    if (hasRtn)
                    {
                        return;
                    }
                    byte[] bytPacketDatas = TCPUtility._Str2Packet(inStr);
                    ushort iSeqNum        = TCPUtility.PrcGetPacketSeqNum(bytPacketDatas);

                    if (iSeqNum != e.iSeqNum)
                    {
                        return;
                    }
                    TSource2 tmpSXFY = (TSource2)TCPUtility._Packet2Str <TSource2>((byte[])e.objPacket, tcpipAgent.Name);

                    recvStr = (Object)tmpSXFY;
                    hasRtn  = true;
                }
                catch (Exception ex)
                {
                    //todo recode log
                }
            }
        }