Показать сообщение отдельно
Старый 01.08.2010, 20:42   #3
Пользователь
 
Регистрация: 01.08.2010
Сообщений: 82
Сказал Спасибо: 49
Имеет 5 спасибок в 4 сообщенях
semiromid пока неопределено
По умолчанию

Разобрался Спасибо).но возникла проблема. Как задержку между отправкой пакетов сделать поменьше?
Цитата:
var
TimerCycle:integer;
timer:TTimer;

procedure Init;
begin
timer:=TTimer.Create(nil);
timer.interval:=1;
timer.OnTimer:=@OnTimer;
timer.enabled:=false;
TimerCycle:=1;
end;

procedure OnTimer(Sender: TObject);
begin
case TimerCycle of
1:begin
buf:=HStr('95 DA 1A 01 10 01 00 00 00 00 00 00 00'); //1 пакет
sendtoserver;
Inc(TimerCycle);
timer.interval:=1;
end;
2:begin
buf:=HStr('2C DA 1A 01 10 01 00 00 00 00 00 00 00 00 00 00 00'); //2 пакет
sendtoserver;
Inc(TimerCycle);
timer.interval:=1;
end;
3:begin
buf:=HStr('95 DA 1A 01 10 01 00 00 00 00 00 00 00'); //3 пакет
sendtoserver;
Inc(TimerCycle);
timer.interval:=1;
end;
4:begin
buf:=HStr('2C DA 1A 01 10 01 00 00 00 00 00 00 00 00 00 00 00'); //4 пакет
sendtoserver;
TimerCycle:=1;
timer.interval:=1;
end;
end;
end;

procedure Free;
begin
timer.free;
end;


begin
useforconnectid := ConnectID;
if FromClient and (pck=HStr('56 0D 00 00 00 00 00 00 00 00')) then timer.enabled:=true;
if FromClient and (pck=HStr('39 0F 02 00 00 00 00 00 00 00')) then timer.enabled:=false;
end.
semiromid вне форума   Ответить с цитированием