> I'm not a beginner with Delphi but I'm definitely not an expert 
> either so I'm really struggling to create a DLL-based WSocket
> client that does what I need.

I wrote an ActiveX DLL about 10 years ago that's still used on my web
site today, doing a reverse DNS look-up on the remote IP address that is
then displayed on the web page.  

It uses normal async ICS components, with a message loop to process the
messages. It is designed with a timeout, so it does not delay the page
been displayed too long if there is not DNS response, but it's easy to
change the main message loop to run until a 'disconnect' flag is set.
The ResultList variable is set in the OnDnsLookupDone event. 
I have an array of sockets so multiple requests can be handled. 

// start lookup
    ResultList [mysocket] := '' ;
    WSockets [mysocket].ReverseDnsLookup (IPAddr) ;

// now wait for lookup to complete or timeout after X seconds
   if (Timeout = 0) or (Timeout > 10) then Timeout := LookupTimeout ;
   WaitTickList [mysocket] := GetTickCount + LongWord (Timeout * 1000) ;
   while ResultList [mysocket] = '' do
   begin
        if GetTickCount >= WaitTickList [mysocket] then
        begin
           try
               WSockets [mysocket].Abort ;
           except
           end ;
           ResultList [mysocket] := '(Lookup Timed Out)' ;
       end ;
       WSockets [mysocket].ProcessMessages ;
       Sleep (0) ;
   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