Re: [twsocket] error dnslookup
Wilfried Mestdagh wrote: > Hello, > >> the ip, if it is ip it should give me host, but it does not, it works >> only with hosts > > Not exacly. If you call it with IP then DNSLookupDone is just called > immediatly with the IP address. Only if you pass it a hostname then a > DNS lookup is done in background and OnDNSLookupDone is called a while > later. As I understand the OP he wants to do a reverse DNS lookup. As far as I know this is possible with TDnsQuery only. Arno Garrels > --- > Rgds, Wilfried > http://www.mestdagh.biz > > Friday, July 15, 2005, 18:54, Develop ics wrote: > >> 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 := ''; >> 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
Re: [twsocket] error dnslookup
Hello, > the ip, if it is ip it should give me host, but it does not, it works > only with hosts Not exacly. If you call it with IP then DNSLookupDone is just called immediatly with the IP address. Only if you pass it a hostname then a DNS lookup is done in background and OnDNSLookupDone is called a while later. --- Rgds, Wilfried http://www.mestdagh.biz Friday, July 15, 2005, 18:54, Develop ics wrote: > 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 := ''; > 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
Re: [twsocket] error dnslookup
Francois PIETTE wrote: 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: 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 := ''; 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 Thz !!! Walter -- 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
Re: [twsocket] error dnslookup
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: 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 := ''; 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