File: src\libraries\Common\src\System\Net\TcpValidationHelpers.cs
Web Access
Project: src\src\libraries\System.Net.Sockets\src\System.Net.Sockets.csproj (System.Net.Sockets)
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
 
namespace System.Net
{
    internal static class TcpValidationHelpers
    {
        public static bool ValidatePortNumber(int port)
        {
            // When this method returns false, the caller should throw
            // 'new ArgumentOutOfRangeException("port")'
            return port >= IPEndPoint.MinPort && port <= IPEndPoint.MaxPort;
        }
    }
}