Hello,

Currently there's only one DNS hostname returned :(  
But I need all records for an SSL post connection check,
so I searched and found them in PHostEnt^.h_aliases.
I just scribbled below lines, so far they work.
What about adding them to WSocket.pas?

procedure GetAliasList(phe : PHostEnt; ToList : TStrings);
type
    TaPChar = array [0..255] of PChar;
    PaPChar = ^TaPChar;
var
    pptr : PaPChar;
    I    : Integer;
    S    : String;
begin
    pptr := PaPChar(Phe^.h_aliases);
    I := 0;
    while pptr^[I] <> nil do begin
        SetLength(S, StrLen(pptr^[I]));
        if Length(S) > 0 then begin
            StrCopy(@S[1], pptr^[I]);
            ToList.Add(S);
        end;
        Inc(I);
    end;
end;

{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
procedure TCustomWSocket.WMAsyncGetHostByAddr(var msg: TMessage);
var
    Phe   : Phostent;
    Error : Word;
begin
    if msg.wParam <> LongInt(FDnsLookupHandle) then
        Exit;
    FDnsLookupHandle := 0;
    Error            := Msg.LParamHi;
    if Error = 0 then begin
        Phe := PHostent(@FDnsLookupBuffer);
        if phe <> nil then begin
            SetLength(FDnsResult, StrLen(Phe^.h_name));
            StrCopy(@FDnsResult[1], Phe^.h_name);
            FDnsResultList.Clear;
            FDnsResultList.Add(FDnsResult);
     ==>    GetAliasList(Phe, FDnsResultList); 
        end;
    end;
    TriggerDnsLookupDone(Error);
end;


---
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html

-- 
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