Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "Сети";
Текущий архив: 2004.04.25;
Скачать: [xml.tar.bz2];

Вниз

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

 
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;
Скачать: [xml.tar.bz2];

Наверх




Память: 0.45 MB
Время: 0.044 c
7-1077458116
DuhcmanSoft
2004-02-22 16:55
2004.04.25
Работа с процессами в ОС Win2k


11-1064220903
RA
2003-09-22 12:55
2004.04.25
Form.CanResize:=true


6-1076358047
valerchik
2004-02-09 23:20
2004.04.25
работа с php


14-1081151876
syte_ser78
2004-04-05 11:57
2004.04.25
Запрограмировался. :)


6-1078114631
Svart
2004-03-01 07:17
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
Английский Французский Немецкий Итальянский Португальский Русский Испанский