'send polling' Do you have this feature?

Jan 16, 2015 at 6:46 PM
Does not speak English. Invite your understanding.


If successive 'send',
There is a phenomenon of 'disconnect'.

So we implemented a direct 'polling'.
I used to override the 'SendInternal'.
protected override void SendInternal(PosList<ArraySegment<byte>> items)
{
    base.SendInternal(items);
    Send_Polling();
}
But the same error flies.
( 'this.IsSending' is also confirmed that the 'false' )


So question.
  1. How to 'send' succession?
  2. Check the 'this.IsSending' is 'false', Why is an error 'send'?
Coordinator
Jan 16, 2015 at 6:48 PM
Chinese?

不太懂你的问题。
Jan 17, 2015 at 6:54 PM
Semple made as follows.

public class claCustomSession : AsyncTcpSession
{
    byte[] m_SendData;

    System.Timers.Timer m_timer1;
    System.Timers.Timer m_timer2;

    public claCustomSession(EndPoint epTemp)
        : base(epTemp)
    {
        this.m_timer1 = new System.Timers.Timer();
        this.m_timer1.Interval = 1000;
        this.m_timer1.Elapsed += m_timer1_Elapsed;

        this.m_timer2 = new System.Timers.Timer();
        this.m_timer2.Interval = 1000;
        this.m_timer2.Elapsed += m_timer1_Elapsed;

        string sTestData = "0011";

        for (int i = 0; i < 1000; ++i)
        {
            sTestData += "1";
        }

        //String to Byte[] Function.
        m_SendData = g_SocketUtile.StringToByte(sTestData);
    }

    void m_timer1_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
    {
        this.Send(m_SendData);
    }

    public void Send(byte[] byteData)
    {
        if (false == base.IsSending)
        {
            base.Send(byteData, 0, byteData.Length); //The disconnect at any moment
        }
    }

    //Call Function.
    public void StartSend()
    {
        this.m_timer1.Start();
        this.m_timer2.Start();
    }

    protected override void SendInternal(PosList<ArraySegment<byte>> items)
    {
        base.SendInternal(items);
    }
}
Call 'public void StartSend()'.
Randomly disconnect.

So question.
  1. How to 'send' succession?
  2. 'base.IsSending == false' is applied to the 'Send End'?