Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Does delphi support getaddrinfo function?

Status
Not open for further replies.

swim

Programmer
Jul 1, 2002
22
US
Hi,

Anyone knows that does delphi support getaddinfo() function which is used for get host ipv6 addr?

I can't find it in winsock2.pas.

Thanks!!!
 
whosrdaddy, thank you for your rapidly answer.

I used Delphi 7, does it use Indy9 or Indy10?

If delphi7 used Indy9, should I install Indy 10?

Thanks a lot
 
If im correct, D7 uses indy v8. you really should use indy10. (don't forget to remove built-in indy version first!)

-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
Delphi 7 has Indy 9.

Steve [The sane]: Delphi a feersum engin indeed.
 
Thanks all.

Delphi7 uses Indy9.

I remove it and install Indy10.

Put a TIdUDPClient on the form and set its IPVersion=IPv6, then get my PC's addr by:

GStack.LocalAddress

The answer is still IPv4 addr, not IPv6(I do have IPv6).

GStack.LocalAddresses return the same IPv4 addr.

Any help?

 
and if you try UDPClient.Binding.IP ??

-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
UDPClient.Binding.IP is a left value? I need a right value to show my IPv6 address.
 
What do you mean by left value, and right value?

You can read and write to the UDPClient.Binding.IP property.
Check that UDPClient.Binding.IPVersion is also set to IPv6 - it should be set when you when you set UDPClient.IPVersion.
 
this works for me:

Code:
procedure TFrm_main.Button1Click(Sender: TObject);

var Hostname : array[0..255] of Char;

begin
 GetHostName(HostName, SizeOf(HostName));
 ShowMessage(GStack.ResolveHost(HostName, id_ipv6));
end;

be aware you need an Indy component on your form, otherwise Gstack is not initialized (and you'll get an AV)

-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
Thanks for Griffyn and whosrdaddy. I'll try it.
 
whosrdaddy,

I tried your code.
It seems that it returns ipv6 address under Windows 2003, but under windows xp, it returns ::1 (loopback address)?

 
You would need the IPv6 TCP stack installed. I think this is an update under Microsoft's WindowsUpdate.
 
Griffyn, thank you for your kind help.

Could you please tell me where to download the IPv6 TCP stack ?

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top