protected override IPAddress GetNextAddress(out Socket attemptSocket)
{
if (_supportsIPv4 || _supportsIPv6)
{
while (_nextAddress < _addressList.Length)
{
IPAddress rval = _addressList[_nextAddress];
++_nextAddress;
if (_supportsIPv6 && rval.AddressFamily == AddressFamily.InterNetworkV6)
{
attemptSocket = new Socket(AddressFamily.InterNetworkV6, _socketType, _protocolType);
return rval;
}
else if (_supportsIPv4 && rval.AddressFamily == AddressFamily.InterNetwork)
{
attemptSocket = new Socket(AddressFamily.InterNetwork, _socketType, _protocolType);
return rval;
}
}
}
attemptSocket = null;
return null;
}