|
//1.结构定义
TMsgHead=packed record
iMsgLen:Longint;
iMsgID:Longint;
sMsgSerial:Array[0..11] of char;
end;
TMsgBody_Bind=packed record
iLoginType:Byte;
sLoginUser:Array[0..15] of char;
sLoginPwd:Array[0..15] of char;
sReserve:Array[0..7] of char;
end;
TMsg_Bind=packed record
MsgHead:TMsgHead;
MsgBody:TMsgBody_Bind;
end;
//2.赋值-----------------------------------------------
function TLT.BindData_Create():TMsg_Bind;
var
BindData:TMsg_Bind;
begin
ZeroMemory(@BindData,Sizeof(BindData));
BindData.MsgBody.iLoginType:=$1;
.....赋值操作
//调用,发送-----------------------------------------------
procedure TForm1.SckLtConnect(Sender: TObject; Socket: TCustomWinSocket);
var
BindData:TMsg_Bind;
begin
BindData:=Lt.BindData_Create;
sckLt.Socket.SendBuf(BindData,sizeof(BindData));
......................
result:=BindData;
//-------------------------------------------------
现在的问题是,结构里面的iloginType等类型,赋数值之后,使用socket发送结构,发现数字1是用01 00 00 00 表示的,而不是00 00 00 01表示的,请问怎么会这样,服务器那边要求必须是00 00 00 01,这该怎么办呀??
盼高手指教! |
|