here's my sample

   sock := TWSocket.Create(nil);
   sock.DnsLookup(IP);
   sock.OnDnsLookupDone := func_dnslookupdone;

You have to revert the last two lines !
The event handler must be defined _before_ calling the method (DnsLookup) that use it.

--
[EMAIL PROTECTED]
http://www.overbyte.be


----- Original Message ----- From: "Develop ics" <[EMAIL PROTECTED]>
To: <twsocket@elists.org>
Sent: Friday, July 15, 2005 6:54 PM
Subject: [twsocket] error dnslookup


Hi
I've a problem with TWSocket when i want to use dnslookup with an ip number. If i give it a host as parameter, it resolves it, but if i give it an ip number it does nothing, i saw in ICS's DnsLook.dpr sample project that if i pass an ip it resolves nice I've a list of hosts and IPs and I pass one by one, if it is host i get the ip, if it is ip it should give me host, but it does not, it works only with hosts

here's my sample

   sock := TWSocket.Create(nil);
   sock.DnsLookup(IP);
   sock.OnDnsLookupDone := func_dnslookupdone;

from there i call the func_dnslookupdone:

procedure Thilo.func_dnslookupdone(Sender: TObject; ErrCode: Word);
begin
   if ErrCode <> 0 then
   begin
       sock.Close;
       sock.Free;
       reloj.Interval := 5000;
       msg := 'Equipo ''' + IP + ''' no conectado (5s)';
       Synchronize(logs);
   end
   else
   begin
       sock.Proto := 'tcp';
       sock.Port := '6666';
       sock.LineMode := true;
       sock.LineEnd := EndOfLine;
       sock.Addr := sock.DnsResult;
       sock.Connect;
       sock.OnSessionConnected := func_sessconnected;
   end;
end;

the sock.DnsResult should give me host (when i give it a IP) but it does nothing

What's my error?

thz

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



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

Reply via email to