CanTryAddressFamily() private méthode

private CanTryAddressFamily ( AddressFamily family ) : bool
family AddressFamily
Résultat bool
        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);
        }
        protected override IPAddress GetNextAddress(out Socket attemptSocket)
        {
            attemptSocket = socket;

            IPAddress rval = null;

            do
            {
                if (nextAddress >= addressList.Length)
                {
                    return(null);
                }

                rval = addressList[nextAddress];
                ++nextAddress;
            }while (!socket.CanTryAddressFamily(rval.AddressFamily));

            return(rval);
        }
Exemple #3
0
        protected override IPAddress GetNextAddress(out Socket attemptSocket)
        {
            _socket.ReplaceHandleIfNecessaryAfterFailedConnect();

            IPAddress rval = null;

            do
            {
                if (_nextAddress >= _addressList.Length)
                {
                    attemptSocket = null;
                    return(null);
                }

                rval = _addressList[_nextAddress];
                ++_nextAddress;
            }while (!_socket.CanTryAddressFamily(rval.AddressFamily));

            attemptSocket = _socket;
            return(rval);
        }