I have a small app that temporary adds several (3-4) IP addresses using AddIPAddress function from IP Helper. After some seconds (2-3), it deletes these addresses using DeleteIPAddress function.
The function DeleteIPAddress works and returns no error, but sometimes (once every 3 or 4 rounds of adding and deleting) it triggers a disconnection event on the interface (exactly like disconnecting and connecting the cable).
I want to avoid these disconnections as they cut any communication being done in the same interface, but I cannot see anything in the documentation regarding this behavior.
This is how I add each IP address:
auto dwRetVal = AddIPAddress(iaIPAddress, iaIPMask, _idx, &NTEContext, &NTEInstance);
if (dwRetVal == ERROR)
{
std::cout << "Error on AddIPAddress" << std::endl;
}
And this is how I delete them:
auto dwRetVal = DeleteIPAddress(ipContext);
if (dwRetVal != NO_ERROR)
{
std::cout << "Error on DeleteIPAddress" << std::endl;
}
Am I missing something?