internal static bool IsIPv4Address (string name)
{
string [] captures = name.Split (new char [] {'.'});
if (captures.Length != 4)
return false;
for (int i = 0; i < 4; i++) {
int length;
length = captures [i].Length;
if (length == 0)
return false;
uint number;
#if NET_2_0
if (!UInt32.TryParse (captures [i], out number))
return false;
#else
try {
number = UInt32.Parse (captures [i]);
} catch (Exception) {
return false;
}
#endif
if (number > 255)
return false;
}
return true;
}