Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2004.04.25;
Скачать: CL | DM;

Вниз

Помогите довести до ума!   Найти похожие ветки 

 
ALeX.B. ©   (2004-02-27 15:59) [0]

ICMP медленно работает.

{ KOL MCK } // Do not remove this line!
{$DEFINE KOL_MCK}
unit Unit1;

interface

{$IFDEF KOL_MCK}
uses Windows, Messages, ShellAPI, KOL, KOLMHIPEdit {$IFNDEF KOL_MCK}, mirror, Classes, Controls, mckControls, mckObjs, Graphics,  MCKMHIPEdit, mckCtrls {$ENDIF},KOLICMP,kolsysutils,Kolping;
{$ELSE}
{$I uses.inc}
 Windows, Messages,  Variants, Classes, Graphics, Controls, Forms,
 Dialogs;
{$ENDIF}

type
 {$IFDEF KOL_MCK}
 {$I MCKfakeClasses.inc}
 {$IFDEF KOLCLASSES} TForm1 = class; PForm1 = TForm1; {$ELSE OBJECTS} PForm1 = ^TForm1; {$ENDIF CLASSES/OBJECTS}
 {$IFDEF KOLCLASSES}{$I TForm1.inc}{$ELSE} TForm1 = object(TObj) {$ENDIF}
   Form: PControl;
 {$ELSE not_KOL_MCK}
 TForm1 = class(TForm)
 {$ENDIF KOL_MCK}
   KOLProject1: TKOLProject;
   KOLForm1: TKOLForm;
   MHIPEdit1: TKOLMHIPEdit;
   MHIPEdit2: TKOLMHIPEdit;
   TreeView1: TKOLTreeView;
   Button1: TKOLButton;
   procedure KOLForm1FormCreate(Sender: PObj);
   procedure Button1Click(Sender: PObj);
 private
   { Private declarations }
procedure TICMPReply(Sender: PObj; Error : Integer);
 public
   { Public declarations }
 end;

var
 Form1 {$IFDEF KOL_MCK} : PForm1 {$ELSE} : TForm1 {$ENDIF} ;
ICMP:PICMP; x, y, t: array [1..4] of integer; i: byte;
{$IFDEF KOL_MCK}
procedure NewForm1( var Result: PForm1; AParent: PControl );
{$ENDIF}

implementation

{$IFNDEF KOL_MCK} {$R *.DFM} {$ENDIF}

{$IFDEF KOL_MCK}
{$I Unit1_1.inc}
{$ENDIF}
procedure scannet(a, b: byte);
begin
for i := a to b do
begin
ICMP.Address := InttoStr(x[1]) + "." + InttoStr(x[2]) + "." + InttoStr(x[3]) + "." + InttoStr(i);
ICMP.Tag :=0;
ICMP.Ping;
end;
end;
procedure TForm1.KOLForm1FormCreate(Sender: PObj);
begin
ICMP:=NEWICMP();
ICMP.OnEchoReply := TICMPReply;
ICMP.Size := 1;
ICMP.TTL := 1;
ICMP.Timeout := 0;
end;
procedure TForm1.TICMPReply(Sender: PObj; Error : Integer);
begin
if error <> 0 then TreeView1.TVInsert(0,0,InttoStr(x[1]) + "." + InttoStr(x[2]) + "." + InttoStr(x[3]) + "." + InttoStr(i));
end;
procedure TForm1.Button1Click(Sender: PObj);
label noscan;  var B:Byte; l,ipos,stip1,stip2,stip3,stip4,eip1,eip2,eip3,eip4,i1,i2,i3,i4,j,k:integer;stip,eip:string;
begin
B:=MHIPEdit1.Fields[0].Value;
stip1:=B;
B:=MHIPEdit1.Fields[1].Value;
stip2:=B;
B:=MHIPEdit1.Fields[2].Value;
stip3:=B;
B:=MHIPEdit1.Fields[3].Value;
stip4:=B;
B:=MHIPEdit2.Fields[0].Value;
eip1:=B;
B:=MHIPEdit2.Fields[1].Value;
eip2:=B;
B:=MHIPEdit2.Fields[2].Value;
eip3:=B;
B:=MHIPEdit2.Fields[3].Value;
eip4:=B;
x[1] := stip1;
x[2] := stip2;
x[3] := stip3;
x[4] := stip4;
y[1] := eip1;
y[2] := eip2;
y[3] := eip3;
y[4] := eip4;
if ((x[1] = y[1]) and (x[2] = y[2]) and (x[3] = y[3]))
   then
     begin
      scannet(x[4], y[4]);
       goto noscan;
     end
   else scannet(x[4], 255);
 inc(x[3]);
 t[2] := y[2];
 t[3] := y[3];
 t[4] := y[4];
 y[2] := 255;
 y[3] := 255;
 y[4] := 255;
 while (x[1] <= y[1]) do
   begin
    if (x[1] = y[1]) then y[2] := t[2];
     while (x[2] <= y[2]) do
       begin
         if ((x[1] = y[1]) and (x[2] = t[2])) then y[3] := t[3] - 1;
         while (x[3] <= y[3]) do
           begin
             scannet(0, 255);
             if (x[3] = y[3]) then break else inc(x[3]);
           end;
         x[3] := 0;
         if (x[2] = y[2]) then break else inc(x[2]);
       end;
     x[2] := 0;
     if (x[1] = y[1]) then break else inc(x[1]);
   end;
 x[2] := t[2];
 x[3] := t[3];
scannet(0,t[4]);
noscan:
end;
end.


 
Verg ©   (2004-02-27 17:24) [1]


> Помогите довести до ума!
> [D7, WinXP]
>
> ALeX.B. ©   (27.02.04 15:59)


Не надо: ум стошнит.
Чесно.



Страницы: 1 вся ветка

Текущий архив: 2004.04.25;
Скачать: CL | DM;

Наверх




Память: 0.46 MB
Время: 0.037 c
14-1080416440
Undert
2004-03-27 22:40
2004.04.25
Как вам такое зверское письмецо и провёрнутые делишки от меня ?


1-1081325699
ksa2002
2004-04-07 12:14
2004.04.25
Table &amp; ComboBox


3-1080716174
Просто гость
2004-03-31 10:56
2004.04.25
Сравнение Grid-ов


1-1081527920
DeveloperUA
2004-04-09 20:25
2004.04.25
Руссификайия EXE


8-1068846700
BlaMyr
2003-11-15 00:51
2004.04.25
Миниатюры графических файлов.





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский