谢谢你的关注,我想的程序主要是消息头和消息体的格式不对,你给我看看程序哪里有问题?
发送消息没有问题,我编了一个服务端程序试过了,关键是cmpp的模拟网关收到消息错误。
type
Cmpp_connect = record
Total_length: longword;
Command_ID: longword;
Sequence_ID: longword;
Source_Addr: array[0..5] of char; //sp_id
AuthenticatorSource: array[0..31] of char;
Version: byte;
TimesSamp: longword;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
pk: Cmpp_connect;
buf:array[1..1024]of char;
pk_len: byte;
begin
pk_len := sizeof(pk);
pk.Total_length := pk_len;
pk.Command_ID := cp_connect;
pk.Sequence_ID := 123456789;
pk.Source_Addr := '123456';
pk.AuthenticatorSource :='123456789abcdefg';
pk.Version := 1;
pk.TimesSamp := 12;
copymemory(@buf,@pk,pk_len);
cl1.Socket.SendBuf(buf,pk_len);
end;