protected override IPAddress GetNextAddress(out Socket attemptSocket)
{
IPAddress rval = null;
do
{
if (_nextAddress >= _addressList.Length)
{
attemptSocket = null;
return null;
}
rval = _addressList[_nextAddress];
++_nextAddress;
}
while (!_socket.CanTryAddressFamily(rval.AddressFamily));
if (SocketPal.SupportsMultipleConnectAttempts)
{
attemptSocket = _socket;
}
else
{
attemptSocket = new Socket(_socket.AddressFamily, _socket.SocketType, _socket.ProtocolType);
if (_socket.AddressFamily == AddressFamily.InterNetworkV6 && _socket.DualMode)
{
attemptSocket.DualMode = true;
}
}
return rval;
}