using System;
using System.Security.Cryptography;
using System.Net.Sockets;
using System.Net;
using System.Text;
using System.Threading;
using System.Collections;
namespace TestAll
{
public delegate void ReportEventHandler(object sender, ReportEventArgs e); //聲明一個事件的指代(指針)
public delegate void SMSEventHandler(object sender, SMSEventArgs e); //聲明一個事件的指代(指針)
public delegate void TerminateEventHandler(object sender,TerminateEventArgs e); //聲明收到終止信號
public delegate void TerminateRespEventHandler(object sender,TerminateRespEventArgs e); //回應事件發生
public delegate void TestEventHandler(object sender,TestEventArgs e);
public delegate void TestRespEventHandler(object sender,TestRespEventArgs e);
public delegate void ConnectRespEventHandler(object sender,ConnectRespEventArgs e);
public delegate void CancelRespEventHandler(object sender,CancelRespEventArgs e);
public delegate void SubmitRespEventHandler(object sender,SubmitRespEventArgs e);
public delegate void QueryRespEventHandler(object sender,QueryRespEventArgs e);
public delegate void LogonSuccEventHandler(object sender,EventArgs e); //當成功登錄系統
public delegate void SocketClosedEventHandler(object sender,EventArgs e); //當套接字被檢測到關閉
public delegate void FailedItemDeletedEventHandler(object sender,WaitingQueueItemEventArgs e); //當一條等待隊列的消息超過60秒沒有回應
public delegate void CMPPClientSvcStopEventHandler(object sender, ClIEntQueueStateArgs e); //當CMPP服務停止時候觸發事件
/// <summary>
/// 作為CMPP協議的客戶端,具有的登陸、發送、接受功能
/// 會開3 個線程處理: 1、處理需要發送 MO(下行)的消息
/// 2、處理從移動服務器發送過來CMPP的消息
/// 3、處理連接斷等信息,檢查需要重發的消息,檢查收到的報告、短信,並調用 OnReport 事件 OnSMS事件
/// </summary>
public class CMPPClIEnt
{
public static long CMPP_ACTIVE_TEST_C_TICKs= 30 ; // *3 ; //長連接的active_test測試時間
public static long CMPP_ACTIVE_TEST_T_TICKs= 60 ; // 消息失敗時間 60秒