这个UNIX下c传送的data_format结构体数据包:
struct stimeval
{
int Tv_Sec
int Tv_Usec
}timeval;
struct data_format
{
byte Data_Type;
short Code;
int Height;
int Velocity;
float Heading;
int X_axis;
int Y_axis;
float Longitude;
float Latitude;
int Sys_Track_No;
int Track_No;
byte Target_Id;
int Obj_Type;
int Weight;
int Ca_Twins[5];
timeval Time_Stamp;
char Info[256];
byte S_Flag;
byte Other_Flag;
char Call_Sign[10];
}
这是在delphi下接收的结构体
type
RdpTimeVal = Record
Tv_Sec:Integer;
Tv_Usec:Integer;
end;
DBCAR =Record
Data_Type : Byte;
Code : SmallInt;
Height : Integer;
Velocity : Integer;
Heading : Single;
X_axis : Integer;
Y_axis : Integer;
Longitude : Single;
Latitude : Single;
Sys_Track_No : Integer;
Track_No : Integer;
Target_Id : Byte;
Obj_Type : Integer;
Weight : Integer;
Ca_Twins : array [0..4] of Integer;
Time_Stamp : RdpTimeVal;
Info :array [0..255] of byte;
S_Flag : Byte;
Other_Flag : Byte;
Call_Sign : array [0..9] of byte;
end;procedure TForm1.IdUDPServer1UDPRead(Sender: TObject; AData: TStream;
ABinding: TIdSocketHandle);
var
car : DBCAR;
str:TMemoryStream;
begin
str:=TMemoryStream.Create;
str.LoadFromStream(AData);
str.Read(plan,str.Size);
Memo2.Lines.Add('类型:'+InttoStr(plan.Data_Type)+','
+'高:'+IntToStr(ntohl(plan.Height))+','
+'序号:'+IntToStr(plan.Call_Sign[0])+','
); str.Free;
end;
struct stimeval
{
int Tv_Sec
int Tv_Usec
}timeval;
struct data_format
{
byte Data_Type;
short Code;
int Height;
int Velocity;
float Heading;
int X_axis;
int Y_axis;
float Longitude;
float Latitude;
int Sys_Track_No;
int Track_No;
byte Target_Id;
int Obj_Type;
int Weight;
int Ca_Twins[5];
timeval Time_Stamp;
char Info[256];
byte S_Flag;
byte Other_Flag;
char Call_Sign[10];
}
这是在delphi下接收的结构体
type
RdpTimeVal = Record
Tv_Sec:Integer;
Tv_Usec:Integer;
end;
DBCAR =Record
Data_Type : Byte;
Code : SmallInt;
Height : Integer;
Velocity : Integer;
Heading : Single;
X_axis : Integer;
Y_axis : Integer;
Longitude : Single;
Latitude : Single;
Sys_Track_No : Integer;
Track_No : Integer;
Target_Id : Byte;
Obj_Type : Integer;
Weight : Integer;
Ca_Twins : array [0..4] of Integer;
Time_Stamp : RdpTimeVal;
Info :array [0..255] of byte;
S_Flag : Byte;
Other_Flag : Byte;
Call_Sign : array [0..9] of byte;
end;procedure TForm1.IdUDPServer1UDPRead(Sender: TObject; AData: TStream;
ABinding: TIdSocketHandle);
var
car : DBCAR;
str:TMemoryStream;
begin
str:=TMemoryStream.Create;
str.LoadFromStream(AData);
str.Read(plan,str.Size);
Memo2.Lines.Add('类型:'+InttoStr(plan.Data_Type)+','
+'高:'+IntToStr(ntohl(plan.Height))+','
+'序号:'+IntToStr(plan.Call_Sign[0])+','
); str.Free;
end;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货