[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

11/03/2009 at 02:36AM PST, ID: 24866588 | Points: 250
[x]
Attachment Details

ICMPClient Ping using BeginThread

Asked by Sookels in Delphi Components

Tags: Delphi

Hi,

I am very new with Delphi and wrote a simple program to check if 5 servers are active over a VPN connection. I am using the Indy TidIcmpClient to simply "ping" the host and check the ms reply time.

To improve on this, I used the BeginThread to check all 5 servers at the same time. The problem that I have is that on my one computer it works fine and I get the status (4 servers up, 1 down), but on my other computer when running the same application at the same time, it is asif all the servers reply at exactly the same speed, and all 5 are up (when I know for a fact that 1 server is down). Both my computers are running Windows 7 64-bit.

EDIT: After adding some code to investigate, I noticed that the host IP address of my threads is correct, but all the MS reply times are exactly the same, asif its using 1 reply for all the diffrent threads. Like I said, I am very new to this, and I used 5 different ICMPClient objects each with its unique name, 1 per thread that I am starting.

EDIT2: I added - label1.Caption := 'IP: ' + pingServer1.Host + ' : ' + pingServer1.ReplyStatus.FromIpAddress; -
From what I can see is it takes the fastest reply from the 5 servers and uses that for all the threads. So even if my pingServer1.Host := '172.20.100.10' (that I know isnt running), the IP from pingServer1.ReplyStatus.FromIpAddress is 172.20.100.5 (that is active) and all the other servers that is also active, gives the same FromIpAddress IP (172.20.100.5) even thou I change the Host of each server.

EDIT3: I am using Delphi 2009.
1:
2:
3:
4:
5:
6:
    pingServer1.Host := Server1IP;
    pingServer1.Ping();
    if (pingServer1.ReplyStatus.MsRoundTripTime < 4500) then
      begin
        do stuff here...
      end
 
Loading Advertisement...
20091111-EE-VQP-91 - Hierarchy / EE_QW_3_20080625