ServicePointManager.ReusePort 属性
定义
将此属性值设置为 true 会导致来自 HttpWebRequest 的所有出站 TCP 连接对套接字使用本机套接字选项 SO_REUSE_UNICASTPORT。Setting this property value to true causes all outbound TCP connections from HttpWebRequest to use the native socket option SO_REUSE_UNICASTPORT on the socket. 这会导致共享基础传出端口。This causes the underlying outgoing ports to be shared. 在短时间内进行大量传出连接并且应用面临端口耗尽风险的情况下,这很有用。This is useful for scenarios where a large number of outgoing connections are made in a short time, and the app risks running out of ports.
public:
static property bool ReusePort { bool get(); void set(bool value); };
public static bool ReusePort { get; set; }
member this.ReusePort : bool with get, set
Public Shared Property ReusePort As Boolean
属性值
注解
默认值是 false。The default value is false.