Background
I have a requirement where I need to remove a few nodes in a network based upon a command given by the user. To keep the nodes from transmitting or receiving data I thought of changing its IP address to some other address. Before I change the address I want to save the node’s IP so that I can re-assign the original IP back to the node after the simulated network outage is over.
My problem is how to efficiently save the nodes’ IP addresses. Should I use a linked list or a hash table?
4
IP(v4) addresses are just four byte long integers presented in a human readable format. You can just store an IP address as an unsigned integer.
1
To keep the nodes from transmitting or receiving data I thought of changing its IP address to some other address.
That is a very dicey solution to your stated problem. You don’t need to worry too much about efficiently storing IP Addresses if your solution doesn’t involve this sort of hack.
1