中国移动短信网关CMPP3.0 C#源代码:数据包定义

开发者福利!热门AI工具限时免费用 购周边即赠Coding Plan Lite,Claude Code、Cursor等20+工具畅享,效率翻倍! 阅读详情

关于联合
CMPP定义的各种数据包采用C语言中的联合(Union)来处理是最有效率的,因为接收和发送的是一个字节数组,使用联合可以方便地在字节数组和数据包结构之间转换。C#本身并不支持联合,但可以使用P/Invoke(平台封送调用)机制实现类似于联合的结构。
在定义CMPP数据包时,我为每个数据包结构定义了Init函数(用于将字节数组转换为数据包结构)和GetBuffer函数(用于将数据包结构转换为字节数组),主要是因为当时对P/Invoke机制不太熟悉。
使用Init和GetBuffer函数的结果是效率要比使用联合低很多,不过压力测试的时候系统表现还是相当稳定的。有兴趣的朋友可以试试用联合实现CMPP的数据包。

using System;
using System.Runtime.InteropServices;

namespace Tiray.SMS
{
 public struct DATA_PACKAGE
 {
  public UInt32 Command;
  public UInt32 SequenceID;//流水号
  public object Data;//数据
  public DateTime SendTime; //数据包发送时间
  public int SendCount;//发送次数
  public int Status;//数据包状态 0--空,1--待发送,2--已发送
 }
 
 #region Enums
 public enum SMS_STATE
 {
  SP_CONNECT,ACTIVE_TEST,ACTIVE_TEST_RESPONSE,SUBMIT,SUBMIT_RESPONSE,DELIVER,DELIVER_RESPONSE,REPORT,SP_DISCONNECT,
  SP_CONNECT_ERROR,ACTIVE_TEST_ERROR,ACTIVE_TEST_RESPONSE_ERROR,SUBMIT_ERROR,SUBMIT_RESPONSE_ERROR,DELIVER_ERROR,DELIVER_RESPONSE_ERROR,SP_DISCONNECT_ERROR,UNKNOW_ERROR

 }

 public enum CODING
 {
  ASCII=0,BINARY=4,UCS2=8,GBK=15
 }
 #endregion

 #region CMPP30 Data Packages
 [ StructLayout( LayoutKind.Sequential, Pack=1,CharSet=CharSet.Ansi )]
 public struct CMPP_HEAD
 {
  public UInt32   TotalLength;
  public UInt32   CommandID;
  public UInt32   SequenceID;
  public Byte[] GetBuffer()
  {
   Byte[] buffer=new Byte[Marshal.SizeOf(this)];//12;
   Byte[] temp=null;
   temp=BitConverter.GetBytes(TotalLength);
   buffer[3]=temp[0];
   buffer[2]=temp[1];
   buffer[1]=temp[2];
   buffer[0]=temp[3];
   temp=BitConverter.GetBytes(CommandID);
   buffer[7]=temp[0];
   buffer[6]=temp[1];
   buffer[5]=temp[2];
   buffer[4]=temp[3];
   temp=BitConverter.GetBytes(SequenceID);
   buffer[11]=temp[0];
   buffer[10]=temp[1];
   buffer[9]=temp[2];
   buffer[8]=temp[3];
   return buffer;
  }
 }

 [ StructLayout( LayoutKind.Sequential, Pack=1,CharSet=CharSet.Ansi )]
 public struct CMPP_CONNECT
 {
  public CMPP_HEAD Head;
  
  [ MarshalAs( UnmanagedType.ByValTStr, SizeConst=6)]
  public string SourceAddress;

  [ MarshalAs( UnmanagedType.ByValArray, SizeConst=16)]
  public Byte[] AuthenticatorSource;
  public Byte Version;
  public UInt32 TimeStamp;
  
  public Byte[] GetBuffer()
  {
   Byte[] temp=null;
   int iPos=0;
   Head.TotalLength=39;
   Byte[] buffer=new Byte[39];
   
   Byte[] HeadBuffer=this.Head.GetBuffer();
   Array.Copy(HeadBuffer,0,buffer,0,HeadBuffer.Length);
   iPos=iPos+HeadBuffer.Length;
   
   temp=Utility.Encode(SourceAddress,CODING.ASCII);
   Array.Copy(temp,0,buffer,iPos,temp.Length);
   iPos=iPos+6;
   
   Array.Copy(AuthenticatorSource,0,buffer,iPos,AuthenticatorSource.Length);
   iPos=iPos+AuthenticatorSource.Length;
   
   buffer[iPos]=Version;
   iPos++;
   
   //temp=BitConverter.GetBytes(TimeStamp);
   temp=Utility.IntToNetBytes(TimeStamp);
   Array.Copy(temp,0,buffer,iPos,temp.Length);
   iPos=iPos+temp.Length;

   return buffer;
  }

 }
 [ StructLayout( LayoutKind.Sequential, Pack=1,CharSet=CharSet.Ansi )]
 public struct CMPP_CONNECT_RESP
 {
  public CMPP_HEAD Head;
  public UInt32 Status;
  [ MarshalAs( UnmanagedType.ByValArray, SizeConst=16)]
  public Byte[] AuthenticatorISMG;
  public Byte Version;

 }
 [ StructLayout( LayoutKind.Sequential, Pack=1,CharSet=CharSet.Ansi )]
 public struct CMPP_SUBMIT
 {
  public CMPP_HEAD Head;
  public UInt64 Msg_ID;
  public Byte Pk_Total;
  public Byte Pk_Number;
  public Byte Registered_Delivery;
  public Byte Msg_Level;
  [ MarshalAs( UnmanagedType.ByValTStr, SizeConst=10)]
  public string Service_Id;
  public Byte Fee_UserType;
  [ MarshalAs( UnmanagedType.ByValTStr, SizeConst=32)]
  public string Fee_Terminal_Id;
  public Byte Fee_Terminal_Type;
  public Byte TP_Pid;
  public Byte TP_Udhi;
  public Byte Msg_Fmt;
  [ MarshalAs( UnmanagedType.ByValTStr, SizeConst=6)]
  public string Msg_Src;
  [ MarshalAs( UnmanagedType.ByValTStr, SizeConst=2)]
  public string FeeType;
  [ MarshalAs( UnmanagedType.ByValTStr, SizeConst=6)]
  public string FeeCode;
  [ MarshalAs( UnmanagedType.ByValTStr, SizeConst=17)]
  public string Valid_Time; 
  [ MarshalAs( UnmanagedType.ByValTStr, SizeConst=17)]
  public string At_Time; 
  [ MarshalAs( UnmanagedType.ByValTStr, SizeConst=21)]
  public string Src_Id;
  public Byte DestUsr_Tl;
  public string[] Dest_Terminal_ID;
  public Byte Dest_Terminal_Type;
  public Byte Msg_Length;
  public string Msg_Content;
  [ MarshalAs( UnmanagedType.ByValTStr, SizeConst=20)]
  public String LinkID;

  public Byte[] GetBuffer()
  {
   
   int iPos=0;
   Msg_Length=(Byte)Utility.CountLength(Msg_Content.ToString(),(CODING)Msg_Fmt);
   Head.TotalLength=(UInt32)(163+32*DestUsr_Tl+Msg_Length);
   Byte[] buffer=new Byte[Head.TotalLength];
   Byte[] temp=null;
   
   Byte[] HeadBuffer=this.Head.GetBuffer();
   Array.Copy(HeadBuffer,0,buffer,0,HeadBuffer.Length);
   iPos=HeadBuffer.Length;
   
   temp=Utility.IntToNetBytes(Msg_ID);
   Array.Copy(temp,0,buffer,iPos,temp.Length);
   iPos=iPos+temp.Length;

   buffer[iPos]=Pk_Total;
   iPos++;

   buffer[iPos]=Pk_Number;
   iPos++;

   buffer[iPos]=Registered_Delivery;
   iPos++;

   buffer[iPos]=Msg_Level;
   iPos++;

   temp=Utility.Encode(Service_Id,CODING.ASCII);
   Array.Copy(temp,0,buffer,iPos,temp.Length);
   iPos=iPos+10;

   buffer[iPos]=Fee_UserType;
   iPos++;

   temp=Utility.Encode(Fee_Terminal_Id,CODING.ASCII);
   Array.Copy(temp,0,buffer,iPos,temp.Length);
   iPos=iPos+32;

   buffer[iPos]=Fee_Terminal_Type;
   iPos++;

   buffer[iPos]=TP_Pid;
   iPos++;
   
   buffer[iPos]=TP_Udhi;
   iPos++;

   buffer[iPos]=Msg_Fmt;
   iPos++;

   temp=Utility.Encode(Msg_Src,CODING.ASCII);
   Array.Copy(temp,0,buffer,iPos,temp.Length);
   iPos=iPos+6;

   temp=Utility.Encode(FeeType,CODING.ASCII);
   Array.Copy(temp,0,buffer,iPos,temp.Length);
   iPos=iPos+2;

   temp=Utility.Encode(FeeCode,CODING.ASCII);
   Array.Copy(temp,0,buffer,iPos,temp.Length);
   iPos=iPos+6;

   temp=Utility.Encode(Valid_Time,CODING.ASCII);
   Array.Copy(temp,0,buffer,iPos,temp.Length);
   iPos=iPos+17;

   temp=Utility.Encode(At_Time,CODING.ASCII);
   Array.Copy(temp,0,buffer,iPos,temp.Length);
   iPos=iPos+17;
   
   temp=Utility.Encode(Src_Id,CODING.ASCII);
   Array.Copy(temp,0,buffer,iPos,temp.Length);
   iPos=iPos+21;

   buffer[iPos]=DestUsr_Tl;
   iPos++;
   
   for(int i=0;i<DestUsr_Tl;i++)
   {
    temp=Utility.Encode(Dest_Terminal_ID[i],CODING.ASCII);
    Array.Copy(temp,0,buffer,iPos,temp.Length);
    iPos=iPos+32;
   }

   buffer[iPos]=Dest_Terminal_Type;
   iPos++;

   buffer[iPos]=Msg_Length;
   iPos++;

   temp=Utility.Encode(Msg_Content,(CODING)Msg_Fmt);
   Array.Copy(temp,0,buffer,iPos,temp.Length);
   iPos=iPos+temp.Length;

   temp=Utility.Encode(LinkID,CODING.ASCII);
   Array.Copy(temp,0,buffer,iPos,temp.Length);
   iPos=iPos+temp.Length;

   return buffer;

  }
 }


 [ StructLayout( LayoutKind.Sequential, Pack=1,CharSet=CharSet.Ansi )]
 public struct CMPP_SUBMIT_RESP
 {
  public CMPP_HEAD Head;
  public UInt64 Msg_ID;
  public UInt32 Result;

 }

 [ StructLayout( LayoutKind.Sequential, Pack=1,CharSet=CharSet.Ansi )]
 public struct CMPP_DELIVER
 {
  public CMPP_HEAD Head;
  public UInt64 Msg_ID;
  [ MarshalAs( UnmanagedType.ByValTStr, SizeConst=21)]
  public string Dest_Id;
  [ MarshalAs( UnmanagedType.ByValTStr, SizeConst=10)]
  public string Service_Id;
  public Byte TP_Pid;
  public Byte TP_Udhi;
  public Byte Msg_Fmt;
  [ MarshalAs( UnmanagedType.ByValTStr, SizeConst=10)]
  public string Src_Terminal_Id;
  public Byte Src_Terminal_Type;
  public Byte Registered_Delivery;
  public Byte Msg_Length;
  public string Msg_Content;
  [ MarshalAs( UnmanagedType.ByValTStr, SizeConst=20)]
  public String LinkID;

  public bool Init(Byte[] buffer)
  {
   int iPos=0;
   bool bOK=true;
   try
   {
    Msg_ID=(UInt64)BitConverter.ToUInt64(buffer,0);
    iPos=iPos+8;

    Dest_Id=Utility.Decode(buffer,iPos,21,CODING.ASCII);
    iPos=iPos+21;

    Service_Id=Utility.Decode(buffer,iPos,10,CODING.ASCII);
    iPos=iPos+10;

    TP_Pid=buffer[iPos];
    iPos++;

    TP_Udhi=buffer[iPos];
    iPos++;

    Msg_Fmt=buffer[iPos];
    iPos++;

    Src_Terminal_Id=Utility.Decode(buffer,iPos,32,CODING.ASCII);
    iPos=iPos+32;

    Src_Terminal_Type=buffer[iPos];
    iPos++;

    Registered_Delivery=buffer[iPos];
    iPos++;

    Msg_Length=buffer[iPos];
    iPos++;

    if(Registered_Delivery==0)//是短消息
    {
     Msg_Content=Utility.Decode(buffer,iPos,Msg_Length,(CODING)Msg_Fmt);

    }
    else//是状态报告,先转为BASE64 String 存储
     Msg_Content=Convert.ToBase64String(buffer,iPos,Msg_Length);
    
    iPos=iPos+Msg_Length;
    LinkID=Utility.Decode(buffer,iPos,20,CODING.ASCII);
   }
   catch
   {
    bOK=false;
   }
   return bOK;

  }
  public CMPP_REPORT GetReport()
  {
   CMPP_REPORT Report=new CMPP_REPORT();
   if(Registered_Delivery==1)//是状态报告
   {
    Byte[] bytes=Convert.FromBase64String(Msg_Content);
    if((bytes!=null)&&(bytes.Length>0))
     Report.Init(bytes);
   }
   return Report;

  }

 }
 [ StructLayout( LayoutKind.Sequential, Pack=1,CharSet=CharSet.Ansi )]
 public struct CMPP_REPORT
 {
  public UInt64 Msg_Id;
  public string Stat;
  public string Submit_Time;
  public string Done_Time;
  public string Dest_Terminal_Id;
  public UInt32 SMSC_Sequence;

  public bool Init(Byte[] buffer)
  {
   int iPos=0;
   bool bOK=true;
   try
   {
    Msg_Id=(UInt64)Utility.NetBytesToInt(buffer,0,8);
    iPos+=8;

    Stat=Utility.Decode(buffer,iPos,7,CODING.ASCII);
    iPos+=7;

    Submit_Time=Utility.Decode(buffer,iPos,10,CODING.ASCII);
    iPos+=10;

    Done_Time=Utility.Decode(buffer,iPos,10,CODING.ASCII);
    iPos+=10;

    Dest_Terminal_Id=Utility.Decode(buffer,iPos,32,CODING.ASCII);
    iPos+=32;

    SMSC_Sequence=(UInt32)Utility.NetBytesToInt(buffer,iPos,4);
   }
   catch
   {
    bOK=false;
   }
   return bOK;

 

  }
 }
 [ StructLayout( LayoutKind.Sequential, Pack=1,CharSet=CharSet.Ansi )]
 public struct CMPP_DELIVER_RESP
 {
  public CMPP_HEAD Head;
  public UInt64 Msg_Id;
  public UInt32 Result;
  public Byte[] GetBuffer()
  {
   int iPos=0;
   Head.TotalLength=(UInt32)Marshal.SizeOf(this);
   Byte[] buffer=new Byte[Head.TotalLength];
   Byte[] temp=null;
   
   Byte[] HeadBuffer=this.Head.GetBuffer();
   Array.Copy(HeadBuffer,0,buffer,0,HeadBuffer.Length);
   iPos=HeadBuffer.Length;
   
   temp=BitConverter.GetBytes(Msg_Id);
   Array.Copy(temp,0,buffer,iPos,temp.Length);
   iPos=iPos+temp.Length;

   temp=Utility.IntToNetBytes(Result);
   Array.Copy(temp,0,buffer,iPos,temp.Length);
   iPos=iPos+temp.Length;

   return buffer;

  }
 }

 [ StructLayout( LayoutKind.Sequential, Pack=1,CharSet=CharSet.Ansi )]
 public struct CMPP_ACTIVE_TEST_RESP
 {
  public CMPP_HEAD Head;
  public Byte Reserved;
  public Byte[] GetBuffer()
  {
   int iPos=0;
   Head.TotalLength=(UInt32)Marshal.SizeOf(this);
   Byte[] buffer=new Byte[Head.TotalLength];
   
   Byte[] HeadBuffer=this.Head.GetBuffer();
   Array.Copy(HeadBuffer,0,buffer,0,HeadBuffer.Length);
   iPos=HeadBuffer.Length;

   buffer[iPos]=Reserved;

   return buffer;

  }
 }

 [ StructLayout( LayoutKind.Sequential, Pack=1,CharSet=CharSet.Ansi )]
 public struct CMPP_CANCEL
 {
  public CMPP_HEAD Head;
  public UInt64 MsgID;
  public Byte[] GetBuffer()
  {
   Byte[] buffer=new Byte[Marshal.SizeOf(this)];
   Byte[] HeadBuffer=this.Head.GetBuffer();
   int iPos=HeadBuffer.Length;
   Array.Copy(HeadBuffer,0,buffer,0,iPos);
   Byte[] temp=BitConverter.GetBytes(MsgID);
   buffer[iPos+7]=temp[0];
   buffer[iPos+6]=temp[1];
   buffer[iPos+5]=temp[2];
   buffer[iPos+4]=temp[3];
   buffer[iPos+3]=temp[4];
   buffer[iPos+2]=temp[5];
   buffer[iPos+1]=temp[6];
   buffer[iPos+0]=temp[7];

   return buffer;
  }
 }
 [ StructLayout( LayoutKind.Sequential, Pack=1,CharSet=CharSet.Ansi )]
 public struct CMPP_CANCEL_RESP
 {
  public CMPP_HEAD Head;
  public UInt32 SuccessID;
 }

 #endregion

}

【待续】

CMPP SMGP SGIP短信平台源码详解与实践 CMPP(China Mobile Peer to Peer)协议,是中国移动定义的用于短信业务的信令协议。SMGP(Short Message Gateway Protocol)是联通定义的协议,SGIP(Short Message Gateway Interface Protocol)则是电信的协议。虽然各运营商定义了自己的协议标准,但它们都旨在实现短信中心与服务提供商之间的高效通信。 阅读详情

相关推荐

CMPP2.0 C# 版本(亲测可用)

CMPP2.0 C# 版本(亲测可用) VS2012工程,带测试程序。 CMPP2.0 C# 版本(亲测可用) VS2012工程,带测试程序。

cmpp2.0移动短信网关c#源代码

源代码,学习用。 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秒没有回应

Net/C# 实现中国移动CMPP v3.0 ISMG SP 收发短信的 SP 客户端

.Net/C# 实现 中国移动 CMPP v3.0 ISMG SP 收发短信的 SP 客户端 (第2版)(CMPP SP Client) 增加了 CMPP Client 类本程序严格按 《中国移动通信企业标准》之《中国移动通信互联网短信网关接口协议(China Mobile Point to Point)》(版本号: 3.0.0) 即: CMPP v3.0.0 http://www.spzone.net/protocol/CMPPV3.0.rar 文档,实现了下面消息的定义及其相关协议级交互: 8.4 业务提供商 (SP) 与互联网短信网关 (ISMG) 间的消息定义 8 8.4.1 SP 请求连接到 ISMG(CMPP_CONNECT) 操作 8 8.4.1.1 CMPP_CONNECT 消息定义 (SP -> ISMG) 8 8.4.1.2 CMPP_CONNECT_RESP消息定义 (ISMG -> SP) 9 8.4.2 SP 或 ISMG 请求拆除连接 (CMPP_TERMINATE)操作 9 8.4.2.1 CMPP_TERMINATE 消息定义 (SP -> ISMG 或 ISMG -> SP) 9 8.4.2.2 CMPP_TERMINATE_RESP 消息定义 (SP -> ISMG 或 ISMG -> SP) 10 8.4.3 SP 向 ISMG提交短信 (CMPP_SUBMIT) 操作 10 8.4.3.1 CMPP_SUBMIT 消息定义 (SP -> ISMG) 10 8.4.3.2 CMPP_SUBMIT_RESP 消息定义 (ISMG -> SP) 11 8.4.5 ISMG 向 SP 送交短信 (CMPP_DELIVER) 操作 13 8.4.5.1 CMPP_DELIVER 消息定义 (ISMG -> SP) 13 8.4.5.2 CMPP_DELIVER_RESP 消息定义 (SP -> ISMG) 16 8.4.7 链路检测 (CMPP_ACTIVE_TEST) 操作 17 8.4.7.1 CMPP_ACTIVE_TEST定义 (SP -> ISMG 或 ISMG <- SP) 17 8.4.7.2 CMPP_ACTIVE_TEST_RESP定义 (SP -> ISMG 或 ISMG <- SP) 17 可采用《中国移动通信 CMPP v3.0 短消息网关模拟器 v1.10》进行测试: 下载于: 《北京风起水流软件工作室》 http://www.zealware.com/download/cmpp3smg.rar本程序以熟悉理解 CMPP 3.0 协议为主要目的,只将 "消息定义" 对象化,其相关协议级交互并未作更深层次的 OO! 也暂无任何错误处理程序! 消息定义的所有字段名称及其数据类型均与上述之 CMPP v3.0.0 文档完全一致! 其间参阅过 shanhe@CSDN or yexiong@cnBlogs 大作(在此鸣谢): http://blog.csdn.net/shanhe/archive/2004/07/19/45383.aspx http://cnblogs.com/yexiong/articles/115330.aspx 但其中有些消息定义字节错位,因此不能正常交互?!且对象化层次较高,不利于理解协议本身! 遂自己动手,丰衣足食,实现部分主要协议(SP 收发短信):

CMPP3.0协议(移动)

CMPP接口协议(移动) 业务提供者与互联网短信网关之间的接口协议 互联网短信网关之间的接口协议 互联网短信网关与汇接网关之间的接口协议 术语和定义 网络结构: 互联网短信网关(ISMG)是业务提供者(SP)与移动网内短信中心之间的中介, SP发送给移动用户的信息 给ISMG ISMG接收到后提交给短信中心. 移动用户点播SP业务的信息由短信中心 通过 ISMG发给SP 为了减轻短信中心的负荷,ISMG根据路由原则将SP提交的信息转发到相应的ISMG ISMG通过汇接网关(GNS)查询的方式获取网关间的

呆大王的博客 7349

什么是CMPP协议

CMPP(China Mobile Peer to Peer)协议是中国移动运营商制定的一种短信网关与SP(Service Provider,服务提供商)之间进行通信的协议标准。该协议主要用于支持运营商与服务提供商之间的短信消息交互,包括发送和接收短信、状态报告、计费等功能。CMPP协议在中国移动短信通信中占有重要地位,是SP与中国移动短信网关之间进行消息交互的基本规范。通过遵循CMPP协议,SP可以有效地与中国移动的网络进行连接,提供稳定可靠的移动短信服务。

hay23455的博客 1890

中国移动短信网关CMPP3.0 C#源代码CMPP30类(1)(转)

中国移动短信网关CMPP3.0 C#源代码CMPP30类(1)(转) 这是2005年6月云南移动短信网关升级到3.0时写的,在SP那稳定运行了很长时间的。因为SP倒闭了,贴出来给有兴趣的朋友参考。优点:支持多线程、滑动窗口、异步发送、全事件模式、自动识别ASCII、GBK、UCS-2缺点:不支持长短信自动分页、不支持PROVISION接口(偶的PROVISION接口是用WEB SERVI

herosen的专栏 4006

中国移动短信网关CMPP3.0 C#源代码:使用示例

Using Tiray.SMS...Tiray.SMS.CMPP30 m_CMPP=new Tiray.SMS.CMPP30();...//启动CMPPm_CMPP=new CMPP30(txt_CMUserName.Text.Trim(),txt_CMPassword.Text.Trim(),txt_CMServerAddress.Text.Trim(),Convert.ToInt32(

[木子]的专栏 7550

中国移动短信网关CMPP3.0 C#源代码CMPP30类(1)

这是2005年6月云南移动短信网关升级到3.0时写的,在SP那稳定运行了很长时间的。因为SP倒闭了,贴出来给有兴趣的朋友参考。优点:支持多线程、滑动窗口、异步发送、全事件模式、自动识别ASCII、GBK、UCS-2缺点:不支持长短信自动分页、不支持PROVISION接口(偶的PROVISION接口是用WEB SERVICE实现的)using System;using System.Text;u

[木子]的专栏 3941

cmpp3.0 c#开发

cmpp3.0 c#开发源码 测试通过

C#调用的,符合CMPP协议的短信接口Demo

短信接口对接,可用来测试短信是否能接通,其中的地址根据实际填写。

中国移动短信网关CMPP3.0 C#源代码CMPP30类(2)

protected CMPP_HEAD ReadHead()  {   CMPP_HEAD head=new CMPP_HEAD();   head.CommandID=0;   Byte[] buffer=new Byte[12];   try   {    if(m_NetworkStream.DataAvailable)    {     m_NetworkStream.Read(buffe

[木子]的专栏 4813

中国移动短信网关CMPP3.0 C#源代码:事件定义及相关工具函数

using System;using System.Text;using System.Runtime.InteropServices;using System.Threading;using System.Collections;using System.Diagnostics;namespace Tiray.SMS{ //事件参数定义 public class SMSEventArgs:Eve

[木子]的专栏 3009

中国移动CMPP接口

下载参考程序 :http://download.csdn.net/detail/adama119/4189313    短信行业已经很成熟了,到处可以找到资料。本人在这个行业干过几年,做过3短信平台都在省级单位省用,做的最复杂的自然是SP的应用,曾经在广电集团工作时做的内容确实非常复杂自己都觉得头疼,当然也和水平有限有关。   2010年底给江苏某国企做了一套行业应用的短信系统,做短信

Adama 7510

从RK3566到RK3588:瑞芯微AIoT芯片选型与开发实战指南

AIoT设备的核心是应用处理器(SoC)的选型与部署。从入门级芯片到旗舰级芯片,瑞芯微提供了阶梯式的硬件平台。RK3566以四核A55和0.8TOPS NPU在成本与性能间取得平衡,支撑了机器鸭等智能硬件的实时交互;而RK3588凭借四核A76+四核A55、6TOPS NPU及更强的编解码能力,成为高端边缘计算与多目视觉的旗舰选择。理解NPU推理中的RKNN模型转换、设备树定制与固件提取等关键技术,能显著缩短产品开发周期。无论智能家居、智慧安防还是边缘AI盒子,合理选型与软硬件协同设计决定了产品的最终竞争力

weixin_33795806的博客 440
上一篇: 中国移动短信网关CMPP3.0 C#源代码:CMPP30类(2)
下一篇: 中国移动短信网关CMPP3.0 C#源代码:事件定义及相关工具函数
bulbul2006
博客等级 码龄20年 27粉丝 79原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值