hy!
i get version and more.. then how to get rpm?
i get version and more.. then how to get rpm?
unit init;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, IdUDPServer, IdBaseComponent, IdComponent, IdUDPBase,
IdUDPClient, IdSocketHandle;
type
THead = record
Size: Byte;
ISP_: Byte;
Reql: Byte;
Data: Byte;
end;
TInit = record
Size: Byte;
ISP_: Byte;
ReqI: Byte;
Data: Byte;
UDPPort: Word ;
Flags: Word;
Sp0: Byte;
Prefix: Byte;
Interval: Byte;
Admin: array[0..15] of char;
PName: array[0..15] of char;
end;
TVer = record
Version: array[0..7] of char;
Product: array[0..5] of char;
InSimVer: Word;
end;
TForm1 = class(TForm)
IdUDPClient1: TIdUDPClient;
IdUDPServer1: TIdUDPServer;
Button1: TButton;
Button2: TButton;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure IdUDPServer1UDPRead(Sender: TObject; AData: TStream; ABinding: TIdSocketHandle);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
Head: THead;
Ver: TVer;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var Init: TInit;
begin
Init.Size:=44;
Init.ISP_:=1;
Init.ReqI:=1;
Init.Data:=0;
Init.UDPPort:=30000;
Init.Flags:=0;
Init.Sp0:=0;
Init.Prefix:=0;
Init.Interval:=1;
Init.Admin:='';
Init.PName:=' InSim Demo';
IdUDPClient1.SendBuffer(Init, SizeOf(Init));
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Head.Size:=4;
Head.ISP_:=3;
Head.Reql:=0;
Head.Data:=2;
IdUDPClient1.SendBuffer(Head, SizeOf(Head));
end;
procedure TForm1.IdUDPServer1UDPRead(Sender: TObject; AData: TStream;
ABinding: TIdSocketHandle);
begin
Application.ProcessMessages;
Adata.Read(Head, sizeof(Head));
if (Head.Size = Adata.Size) and (Head.ISP_ = 3) and (Head.Data = 0) then
begin
Head.Size:=4;
Head.ISP_:=3;
Head.Reql:=0;
Head.Data:=0;
IdUDPClient1.SendBuffer(Head, SizeOf(Head));
end;
if (Head.Size = Adata.Size) and (Head.ISP_ = 2) and (Head.Data = 0) then
begin
Adata.Read(Ver, sizeof(Ver));
Memo1.Lines.Add('Version: '+Ver.Version);
Memo1.Lines.Add('Product: '+Ver.Product);
Memo1.Lines.Add('InSimVer: '+IntToStr(Ver.InSimVer));
end;
end;
end.