rlebeau on Indy11-preparation
Fixing a small typo in checkin … (compare)
rlebeau on master
Fixing a small typo in checkin … (compare)
rlebeau on Indy11-preparation
Fixing some missing closing com… Removing GetLocalTime() from Id… Adding deprecated to IdServerIO… and 1 more (compare)
rlebeau on master
#447 Fixing compiler errors wit… (compare)
const
cMulticastGroupIPv6 = 'FF02:0:0:0:0:0:0:1';
procedure TForm1.FormCreate(Sender: TObject);
var
I: Integer;
LBinding: TIdSocketHandle;
begin
FLocalAddresses := TIdStackLocalAddressList.Create;
GStack.GetLocalAddressList(FLocalAddresses);
BroadcastServerIPv6.Port := 6000;
BroadcastServerIPv6.MulticastGroup := cMulticastGroupIPv6;
BroadcastServerIPv6.Active := True;
BroadcastListenerIPv6.DefaultPort := 6000;
BroadcastListenerIPv6.IPVersion := TIdIPVersion.Id_IPv6;
BroadcastListenerIPv6.MulticastGroup := cMulticastGroupIPv6;
BroadcastListenerIPv6.Bindings.Clear;
for I := 0 to FLocalAddresses.Count - 1 do
begin
if FLocalAddresses[I].IPVersion = TIdIPVersion.Id_IPv6 then
begin
LBinding := BroadcastListenerIPv6.Bindings.Add;
LBinding.IP := FLocalAddresses[I].IPAddress;
LBinding.IPVersion := TIdIPVersion.Id_IPv6;
LBinding.Port := BroadcastListenerIPv6.DefaultPort;
end;
end;
BroadcastListenerIPv6.Active := True;
end;
gethostname()
or getaddrinfo()
directly (which are wrapped by Indy's TIdStack.HostByName()
method), which uses the OS's own DNS resolver; and then 2) resolve the HostName using gethostbyaddr()
or getnameinfo()
(which are wrapped by Indy's TIdStack.HostByAddress()
method), which also use the OS's own DNS resolver. Yes, TIdDNSResolver
requires a Host
, because it implements DNS manually from scratch, and doesn't use the OS resolver at all. You can query your OS's DNS server(s), or let the user specify them.
TIdSync
still works, but is deprecated because TThread::Synchronize()
with an anonymous procedure accomplishes the same thing that TIdSync
was originally intended for. Read Embarcadero's documentation for How to Handle Delphi Anonymous Methods in C++.