3.0的版本,高4bit为3,低4位为0
private uint _Timestamp; // 4 Unsigned Integer 时间戳的明文,由客户端产生,格式为MMDDHHMMSS,即月日时分秒,10位数字的整型,右对齐 。
private MessageHeader _Header;
public MessageHeader Header
{
get
{
return _Header;
}
}
public byte[] AuthenticatorSource
{
get
{
return _AuthenticatorSource;
}
}
public CMPP_CONNECT
(
string Source_Addr
, string Password
, DateTime Timestamp
, uint Version
, uint Sequence_Id
)
{
_Header = new MessageHeader
(
MessageHeader.Length + BodyLength
, CMPP_Command_Id.CMPP_CONNECT
, Sequence_Id
);
_Source_Addr = Source_Addr;
_Password = Password;
string s = Utility.Get_MMDDHHMMSS_String(Timestamp);
_Timestamp = UInt32.Parse(s);
byte[] buffer = new byte[6 + 9 + _Password.Length + 10];
Encoding.ASCII.GetBytes(_Source_Addr).CopyTo(buffer, 0);
Encoding.ASCII.GetBytes(_Password).CopyTo(buffer, 6 + 9);
Encoding.ASCII.GetBytes(s).CopyTo(buffer, 6 + 9 + _Password.Length);
_AuthenticatorSource = new MD5CryptoServiceProvider().ComputeHash(buffer, 0, buffer.Length);
_Version = Version;
}
public byte[] ToBytes()
{
int i = 0;
byte[] bytes = new byte[MessageHeader.Length + BodyLength];
//header 12
byte[] buffer = _Header.ToBytes();
Buffer.BlockCopy(buffer, 0, bytes, i, buffer.Length);
//Source_Addr 6
i += MessageHeader.Length;
buffer = Encoding.ASCII.GetBytes(_Source_Addr);
Buffer.BlockCopy(buffer, 0, bytes, i, 6);
//AuthenticatorSource 16
i += 6;
buffer = _AuthenticatorSource;
Buffer.BlockCopy(buffer, 0, bytes, i, buffer.Length); //16
//version 1
i += 16;
bytes[i++] = (byte) _Version; //版本
//Timestamp
buffer = BitConverter.GetBytes(_Timestamp);
Array.Reverse(buffer);
buffer.CopyTo(bytes, i);
return (bytes);
}
public override string ToString()
{
return "[\r\n"
+ _Header.ToString() + "\r\n"
+ "\t"
+ string.Format
(
"MessageBody:"
+ "{0}AuthenticatorSource: {1}"
+ "{0}Password: {2}"
+ "{0}Source_Addr: {3}"
+ "{0}Version: {4}"
, "\r\n\t\t"
, Utility.BytesArrayToHexString(_AuthenticatorSource)
, _Password
, _Source_Addr
, _Timestamp
, _Version
)
+ "\r\n]";
}
}
public class CMPP_CONNECT_RESP //: CMPP_Response
{
private MessageHeader _Header;
public const int BodyLength = 4 + 16 + 1;
private uint _Status; // 4 Unsigned Integer 状态
// 0:正确
// 1:消息结构错
// 2:非法源地址
// 3:认证错
// 4:版本太高
// 5~:其他错误
private byte[] _AuthenticatorISMG; // 16 Octet Strin
C# 实现 中国移动 CMPP v3.0 ISMG SP 收发短信的 SP 客户端 (CMPP SP Client)_金融/投资_经管营销_专业资料。.Net/C# 实现 中国移动 CMPP v3.0 ISMG ...
接收到已经建立正确连接的 返回信息 SP SP 向 ISMG 发送正确的连接请 求 ISMG... C# 实现 中国移动 CMPP ... 54页 免费 2009年7月7日中国移动TD... 21...
下载客户端
下载客户端
下载客户端
客户API接口函数,包括登录PROXY、 退出PROXY、发送短...中的 CMPP_Cancel_REP的消息,是SMProxy发送删除短信...建立连接所需参数--> <ismg> <!-- ISMG主机...
SP短信平台ISMG V1.0说明... 21页 4下载券 中国移动 CMPP v3.0 ISM....ISMG 测试条件: SP 发送给 ISMG 基本的连接请求到端口 7890 测试步骤及用例 1...
下载客户端
2 CMPP3.0 2.1网络结构 如图1所示: 图1 互联网短信网关组网结构 如图1所示,互联网短信网关(ISMG)是业务提供商(SP)与移动网内短信中心之间的中介实体,互联...
摘要CMPP(中国移动点对点协议)规定了移动梦网短信业务开展过程中各网元(包括 ISMG、GNS 和 SP)之间的消息类型 和定义, 本文讲述基于 CMPP3.0 标准的企业短信...
热门文档