\r
 //convert a name to an IP\r
 //will return v4 or v6 depending on what seems favorable, or manual preference setting\r
 \r
 //convert a name to an IP\r
 //will return v4 or v6 depending on what seems favorable, or manual preference setting\r
 function forwardlookup(name:ansistring;timeout:integer):tbinip;\r
 \r
 //convert a name to a list of all IP's returned\r
 function forwardlookup(name:ansistring;timeout:integer):tbinip;\r
 \r
 //convert a name to a list of all IP's returned\r
   const\r
     winsocket = 'wsock32.dll';\r
   function sendto(s: TSocket; const Buf; len, flags: Integer; var addrto: TinetSockAddrV; tolen: Integer): Integer; stdcall; external    winsocket name 'sendto';\r
   const\r
     winsocket = 'wsock32.dll';\r
   function sendto(s: TSocket; const Buf; len, flags: Integer; var addrto: TinetSockAddrV; tolen: Integer): Integer; stdcall; external    winsocket name 'sendto';\r
       makeinaddrv(biniptemp,inttostr( porttemp ),inaddrtemp);\r
 \r
       fd[a] := Socket(biniptemp.family,SOCK_DGRAM,0);\r
       makeinaddrv(biniptemp,inttostr( porttemp ),inaddrtemp);\r
 \r
       fd[a] := Socket(biniptemp.family,SOCK_DGRAM,0);\r
         raise Exception.create('unable to bind '+inttostr(WSAGetLastError));\r
       {$else}\r
         raise Exception.create('unable to bind '+inttostr(socketError));\r
         raise Exception.create('unable to bind '+inttostr(WSAGetLastError));\r
       {$else}\r
         raise Exception.create('unable to bind '+inttostr(socketError));\r
     b := 0;\r
     for socknum := numsockused-1 downto 0 do if fd[socknum] > b then b := fd[socknum];\r
     selectresult := select(b+1,@fds,nil,nil,@selecttimeout);\r
     b := 0;\r
     for socknum := numsockused-1 downto 0 do if fd[socknum] > b then b := fd[socknum];\r
     selectresult := select(b+1,@fds,nil,nil,@selecttimeout);\r
     if (useaf = useaf_v4) then a := af_inet else if (useaf = useaf_v6) then a := af_inet6 else a := 0;\r
     result := winforwardlookuplist(name,a,dummy);\r
     {$ifdef ipv6}\r
     if (useaf = useaf_v4) then a := af_inet else if (useaf = useaf_v6) then a := af_inet6 else a := 0;\r
     result := winforwardlookuplist(name,a,dummy);\r
     {$ifdef ipv6}\r