Beispiel #1
0
        /// <summary>
        /// 接收数据
        /// </summary>
        /// <param name="value"></param>
        /// <param name="type"></param>
        /// <param name="startIndex">起始位置</param>
        /// <param name="data">数据缓存</param>
        /// <param name="length">待接收数据长度</param>
        /// <param name="timeout">超时时间</param>
        internal void receive(object value, receiver.type type, byte[] data, int startIndex, int length, DateTime timeout)
        {
            receiver receiver = typePool <receiver> .Pop();

            if (receiver == null)
            {
                try
                {
                    receiver = new receiver();
                }
                catch (Exception error)
                {
                    log.Error.Add(error, null, false);
                }
                if (receiver == null)
                {
                    receiver.OnReceive(value, type, false);
                    return;
                }
            }
            currentReceiveData       = data;
            currentReceiveStartIndex = startIndex;
            currentReceiveEndIndex   = length + startIndex;
            receiver.Receive(this, value, type, timeout);
        }
Beispiel #2
0
 internal void receive(object value, receiver.type type, int startIndex, int length, DateTime timeout)
 {
     receive(value, type, currentReceiveData, startIndex, length, timeout);
 }