天天看點

jemter java.net.BindException:Address alreardy in use異常解決方法

現象:

jemter java.net.BindException:Address alreardy in use異常解決方法

原因:

Windows 本身提供端口通路機制的問題。

windows 提供給TCP/IP 連結端口為 1024 ~5000,并且要用4分鐘來進行循環回收這些端口,這時如果我們在短時間内跑大量請求時就會把端口占滿。

解決方案:

win + r  輸入 regedit 打開系統資料庫  找到以下路徑

計算機\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters

右擊Parameters 建立 DWORD  名字為MaxUserPort  值 為 65534 (最大65535 設定65534 防止把所有的端口占用了)

右擊Parameters 建立 DWORD  名字為 TCPTimedWaitDelay  值為 30 (預設機關為 秒)

jemter java.net.BindException:Address alreardy in use異常解決方法
jemter java.net.BindException:Address alreardy in use異常解決方法

參考:https//support.microsoft.com/zh-cn/help/196271/when-you-try-to-connect-from-tcp-ports-greater-than-5000-you-recelve-t