请各位兄弟帮忙 ( 积分: 200 )

  • 主题发起人 主题发起人 chwa
  • 开始时间 开始时间
C

chwa

Unregistered / Unconfirmed
GUEST, unregistred user!
如何在客户端取得短信的发送状态返回报告。需要用smpp协议。最好要有源代码。谢谢
 
如何在客户端取得短信的发送状态返回报告。需要用smpp协议。最好要有源代码。谢谢
 
转了几个帖子,应该有你要的东西
http://www.delphibbs.com/delphibbs/dispq.asp?lid=1817362

http://www.delphibbs.com/delphibbs/dispq.asp?lid=934785

http://www.delphibbs.com/delphibbs/dispq.asp?lid=2427613

http://www.delphibbs.com/delphibbs/dispq.asp?lid=2502856

http://www.delphibbs.com/delphibbs/dispq.asp?lid=672485

http://www.delphibbs.com/delphibbs/dispq.asp?lid=1080251

大牛的回答
-----------------------转自网络
function IPSend(pBuf : pointer; nSize : longint) : longint;
//封装在一个dll中的socket 发送函数.关键在于调用这个函数发送消息包
//以下是结构声明
type
DATA_MSG = record
Head: tagPureMTHead;
Data: array[0..MAX_MSG_DATA_LEN-1] of Byte;
end;

tagPureMTHead = record
nLen: DWORD;
nCmdID: DWORD;
nSenderID: DWORD;
nRecverID: DWORD;
nSequenceID: DWORD;
nStatus: DWORD;
end;

//一个线程中的函数
procedure TTCPSend.Execute;
var
Buf : DATA_MSG;
MTBuf: MT_DATA_MSG;
SmsBuf: SMS_DATA_MSG;
DataLen : longint;
ErrorID : DWORD;
ReceiverID: DWORD;
sSendDirection: string;
begin
{ Place thread code here }
ThreadExitEvent.ResetEvent;

while (not self.Terminated) do
begin
//降低CPU占用率
//ThreadIsExitEvent.WaitFor(1);
//发送数据
DataLen := sizeof(DATA_MSG);
//没有数据
if not (MsgBufMng.WaitFor(m_SendID, 2000) = wrSignaled) then
Continue;

while MsgBufMng.GetMsgFromID(@Buf, DataLen, m_SendID) do
begin
DataLen := DATA_MSG((@Buf)^).HEAD.nLen; //试添加
nCommandID := DATA_MSG((@Buf)^).HEAD.nCmdID;
nSequenceID := DATA_MSG((@Buf)^).HEAD.nSequenceID;
ReceiverID := DATA_MSG((@Buf)^).HEAD.nRecverID;
if loginType = ltMtServer then
begin
if ReceiverID = SENDER_ID_FROM_MT_SERVER then
//这里发送数据
ErrorID := IPSend(@Buf, DataLen) //发送数据
else
begin
DataLen := DataLen + sizeOf(tagPureSmsHead);
CopyMemory(@(MTBuf.MTHead), @(Buf.Head), SizeOf(Buf.Head));
MTBuf.MTHead.nLen := DataLen;

MTBuf.SmsHead.nLen := DataLen;
MTBuf.SmsHead.nCmdID := Buf.Head.nCmdID;
MTBuf.SmsHead.nStatus := Buf.Head.nStatus;
MTBuf.SmsHead.nSequenceID := Buf.Head.nSequenceID;

CopyMemory(@(MTBuf.Data), @(Buf.Data), SizeOf(Buf.Data));

ErrorID := IPSend(@MTBuf, DataLen); //发送数据
end
{$else}
ErrorID := IPSend(@Buf, DataLen); //发送数据
{$endif}
end
else if LoginType = ltSms then
begin
DataLen := DataLen - SizeOf(tagPureMTHead) + SizeOf(tagPureSmsHead);

SmsBuf.Head.nLen := DataLen;
SmsBuf.Head.nCmdID := Buf.Head.nCmdID;
SmsBuf.Head.nStatus := Buf.Head.nStatus;
SmsBuf.Head.nSequenceID := Buf.Head.nSequenceID;
CopyMemory(@(SmsBuf.Data), @(Buf.Data), SizeOf(Buf.Data));
ErrorID := IPSend(@SmsBuf, DataLen);
end;
//Synchronize(ShowSendState);
//发送失败,Socket断连,退出线程
if ErrorID <> 0 then
begin
ConnectError.SetEvent;
Break;
end
else
begin
if (nCommandID = CMD_MT_SHAKE_HAND) and not FTraceShakeHandSwitch then
else
begin
case LoginType of
ltMtServer:
begin
...
end;

ltSms:
begin
...
end;
end;
end;
end;
DataLen := sizeof(DATA_MSG); //重要!恢复初始长度之用.
end; //while 发送数据
end; //while
ThreadExitEvent.SetEvent;
end;
 
to chenybin:
非常感谢!但不是我需要的,我希望使用SMPP协议向短信网关提交submit后,能得到
我刚提交的短信的返回状态报告。不知道有人做过没有,最好有源代码或提示要注意那方面的事项。
 
SMPP和CMPP有什么区别么????CMPP的我就有一些VB的代码的
 

Similar threads

后退
顶部