'IsSending == false' is 'send ready'?

Mar 17, 2015 at 7:47 AM
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.

How to safely 'send'?