The following code to converts an IP to an int in a very fast way:
static int ipToInt(int first, int second, int third, int fourth)
{
return (first << 24) | (second << 16) | (third << 8) | (fourth);
}
Question
How do I use bit shifting to convert the value back to an IP address?
Try the following
Or to avoid an excessive number of out parameters, use a
structGeneral Question: Why are you using
inthere instead ofbyte?