> Am looking for a quick dirty way to get users MS ping from main 
> chat server to client I seen a ping demo in src but seams over 
> complex is there a easier way to get users ping speed?

No easier way, ping does not require much code, this is a cut down example from
the IP Logger component I asked you to look at last week:

with TPingThread.Create (True) do   // create suspended
begin
    FreeOnTerminate := True;
    PingId := Socnr ;
    OnTerminate := PingThreadDone ;
    PingHostName := RemHost ;
    PingSocketFamily := BindFamily ;  
    PingSrcAddress := ICS_ANY_HOST_V4 ;
    PingSrcAddress6 := ICS_ANY_HOST_V6 ;
    PingTimeout := FPingWaitSecs * 1000 ;
    PingTTL := 40 ;     // hops
    PingLookupReply := false ;  // reverse DNS
    Resume ; // start it now, with Delphi XE should use Start
    result := true ;
end ;


procedure TMagIpLog.PingThreadDone (Sender: TObject);
begin   
  with Sender as TPingThread do   // this event is thread safe
  begin
   if ErrCode = 0 then
   begin
       RemIp := DnsHostIP ;
       BindFamily := PingSocketFamily ;
       if DnsHostIP <> ReplyIPAddr then
           FLastErrorStr := FCurTitle + ' Ping Did Not Reach Host';
   end else        
       FLastErrorStr := FCurTitle + ' Failed Ping' ;
end;       

Angus

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to