G
goldbear
Unregistered / Unconfirmed
GUEST, unregistred user!
我现在写一个通讯程序,用tclientsocket向服务器发送消息,数据包格式是
buf[0]=16,buf[1-2]=11,buf[3-4]=1,buf[5-6]=0,buf[7,10]='oxabcdef',请问该数据
包该如何发送?
附程序如下:
procedure Tmainfrm.logincsocketConnect(Sender: TObject;
Socket: TCustomWinSocket);
type
PVersionCheck = record
pnum: byte;
plength: word;
versionnumhigh,versionnumlow:word;
checkwords: longword;
end;
var
dataVersionCheck;
datalen:integer;
begin
with data do
begin
pnum:=16;
plength:=11;
versionnumhigh:=1;
versionnumlow:=0;
checkwords:='0xabcdefab';
end;
Socket.SendBuf(data,sizeof(data));
...........................................
.......................................
请问该段程序是否正确?
buf[0]=16,buf[1-2]=11,buf[3-4]=1,buf[5-6]=0,buf[7,10]='oxabcdef',请问该数据
包该如何发送?
附程序如下:
procedure Tmainfrm.logincsocketConnect(Sender: TObject;
Socket: TCustomWinSocket);
type
PVersionCheck = record
pnum: byte;
plength: word;
versionnumhigh,versionnumlow:word;
checkwords: longword;
end;
var
dataVersionCheck;
datalen:integer;
begin
with data do
begin
pnum:=16;
plength:=11;
versionnumhigh:=1;
versionnumlow:=0;
checkwords:='0xabcdefab';
end;
Socket.SendBuf(data,sizeof(data));
...........................................
.......................................
请问该段程序是否正确?