Windows Server 2003
1758610 Members
2183 Online
108873 Solutions
New Discussion

Problem with Windows system call: GetAdaptersAddresses

 
VijayK_1
New Member

Problem with Windows system call: GetAdaptersAddresses

Hi,
I am using the Windows system call "GetAdaptersAddresses" to retrieve IPv4 & IPv6 addresses assigned to various interfaces on my PC having Windows 2003.

Its bit strange that it returns the addresses in a wrong manner for manually added global addresses. Assume if there are three different addresses assigned to an interface, when I try to retrive using the above API, it returns three addresses but just repeats the first one three times. For better clarity here I am explaining with actuals.

I have configured the following IP Addresses on my system(Windows 2003 Server):
10.64.70.191
2001:db8:c18:1:214:38ff:febe:ecad
2001:db8:c18:1:214:38ff:febe:ecac
2001:db8:c18:1:214:38ff:febe:ecab
fe80::214:38ff:febe:ecab

From the above IPv6 addresses I have added 2001:db8:c18:1:214:38ff:febe:ecad & 2001:db8:c18:1:214:38ff:febe:ecac manually using netsh command.

Now the problem is the Windows system call "GetAdaptersAddresses" is returning the addresses as below:

10.64.70.191
2001:db8:c18:1:214:38ff:febe:ecad
2001:db8:c18:1:214:38ff:febe:ecad
2001:db8:c18:1:214:38ff:febe:ecad
fe80::214:38ff:febe:ecab

Incase of global address it is just repeating the first one three times.

I am not sure what going wrong and is this a known issue. It would be of great help if anybody can provide some info on this.

Thanks&Regards
VijayK