Example #1
0
        // 发送消息队列中的第一条消息
        protected override void ProcessSendData()
        {
            try
            {
                if (mSendList.Count <= 0)
                {
                    return;
                }

                if (null != mSession)
                {
                    mWebClient.Headers.Set("SESSIONID", mSession);
                }
                Packet packet = mSendList[0] as Packet;
                mWebClient.UploadDataAsync(mUrl, packet.mNetData);
                mLastTime = DateTime.Now;
            }
            catch (System.Exception e)
            {
                Log.e(e, Log.Tag.Net);
                //addErrorPacket(ErrorType.SendException);
            }
            finally
            {
                mReadySend = false;
            }
        }
Example #2
0
    private void SendData()
    {
        if (SendQueue.Count <= 0)
        {
            return;
        }
        // Packet sendPackage = mSendQueue.Dequeue();
        // byte[] data = sendPackage.GetBytes();
        byte[] data = SendQueue.Dequeue();
        mWebClient.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
        mWebClient.Headers.Add("ContentLength", data.Length.ToString());

        try
        {
            mWebClient.UploadDataAsync(mUrl, data);
        }
        catch (System.Exception e)
        {
            Debug.LogError("HttpObject SendData Exception: " + e.Message);
        }

        IsReadySend = false;
    }