{"id":538,"date":"2016-09-12T21:01:44","date_gmt":"2016-09-12T21:01:44","guid":{"rendered":"7bcdf75ad237b8e02e301f4091fb6bc8"},"modified":"2016-09-12T21:01:44","modified_gmt":"2016-09-12T21:01:44","slug":"","status":"publish","type":"post","link":"https:\/\/www.xiaobo.li\/notes\/archives\/538","title":{"rendered":"TcpTimedWaitDelay\/MaxUserPort"},"content":{"rendered":"<div id=\"cnblogs_post_body\">\n<p>\u5f53TCP\u8fde\u63a5\u88ab\u5173\u95ed\u65f6\uff0c{ Protocol, Local IP, Local Port, Remote IP, Remote Port}\u4e94\u5143\u7ec4\u5c31\u8fdb\u5165TIME_WAIT\u72b6\u6001\uff0c\u9ed8\u8ba4\u65f6\u95f4\u662f4\u5206\u949f\u3002\u53ef\u4ee5\u901a\u8fc7\u4e00\u7ec4\u547d\u4ee4\u770b\u770btcp\u7684\u8fde\u63a5\u72b6\u6001\uff1a <\/p>\n<p>netstat -ano&gt;&gt;c:\\port.txt <\/p>\n<p><code>netstat -n | find \/C \/I \"established\"<br \/>\n\u67e5\u770b\u8fde\u63a5\u4e0e\u5185\u5b58<br \/>\nss -s &amp;&amp; free -g<\/p>\n<p><\/code><\/p>\n<p>\u672c\u5730ip\uff0c\u8fdc\u7a0bip\uff0c\u8fdc\u7a0b\u7aef\u53e3\u90fd\u662f\u56fa\u5b9a\u7684\uff0c\u53ea\u6709\u672c\u5730\u7aef\u53e3\u662f\u53d8\u5316\u7684\uff0c\u672c\u5730\u7aef\u53e3\u53ea\u80fd\u4f7f\u75281024-5000\uff0c\u56e0\u6b64\u5982\u679c\u57284\u5206\u949f\u5185\u53d1\u8d77\u4e86\u5927\u7ea64000\u4e2a\u8fde\u63a5\uff0c\u8fd9\u65f6\u5c31\u4f1a\u53d1\u751f\u5f02\u5e38\uff0c\u4e0b\u9762\u662f\u4f7f\u7528WCF\uff0c\u5ba2\u6237\u7aef\u7684\u5f02\u5e38: <\/p>\n<p>System.Net.Sockets.SocketException: Only one usage of each socket<br \/>\naddress (protocol\/network address\/port) is normally permitted<br \/>\n192.168.101.5:8888 <br \/>\nat System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) <br \/>\nat System.Net.Sockets.Socket.Connect(EndPoint remoteEP) <br \/>\nat System.ServiceModel.Channels.SocketConnectionInitiator.Connect(Uri uri, TimeSpan timeout) <\/p>\n<p>\n<b>TcpTimedWaitDelay \u63cf\u8ff0\uff1a<\/b><br \/>\nHKEY_LOCAL_MACHINE\/SYSTEM\/CurrentControlSet\/Services\/TCPIP\/Parameters<br \/>\n\u786e\u5b9a TCP\/IP \u53ef\u91ca\u653e\u5df2\u5173\u95ed\u8fde\u63a5\u5e76\u91cd\u7528\u5176\u8d44\u6e90\u524d\uff0c\u5fc5\u987b\u7ecf\u8fc7\u7684\u65f6\u95f4\u3002\u5173\u95ed\u548c\u91ca\u653e\u4e4b\u95f4\u7684\u6b64\u65f6\u95f4\u95f4\u9694\u901a\u79f0 TIME_WAIT \u72b6\u6001\u6216\u4e24\u500d\u6700\u5927\u6bb5\u751f\u547d\u5468\u671f\uff082MSL\uff09\u72b6\u6001\u3002<br \/>\n\u6b64\u65f6\u95f4\u671f\u95f4\uff0c\u91cd\u65b0\u6253\u5f00\u5230\u5ba2\u6237\u673a\u548c\u670d\u52a1\u5668\u7684\u8fde\u63a5\u7684\u6210\u672c\u5c11\u4e8e\u5efa\u7acb\u65b0\u8fde\u63a5\u3002<br \/>\n\u51cf\u5c11\u6b64\u6761\u76ee\u7684\u503c\u5141\u8bb8 TCP\/IP \u66f4\u5feb\u5730\u91ca\u653e\u5df2\u5173\u95ed\u7684\u8fde\u63a5\uff0c\u4e3a\u65b0\u8fde\u63a5\u63d0\u4f9b\u66f4\u591a\u8d44\u6e90\u3002<br \/>\n\u5982\u679c\u8fd0\u884c\u7684\u5e94\u7528\u7a0b\u5e8f\u9700\u8981\u5feb\u901f\u91ca\u653e\u548c\u521b\u5efa\u65b0\u8fde\u63a5\uff0c\u800c\u4e14\u7531\u4e8e TIME_WAIT \u4e2d\u5b58\u5728\u5f88\u591a\u8fde\u63a5\uff0c\u5bfc\u81f4\u4f4e\u541e\u5410\u91cf\uff0c\u5219\u8c03\u6574\u6b64\u53c2\u6570\u3002 <\/p>\n<p><b>\u53c2\u8003\uff1a<\/b><a target=\"_blank\" href=\"https:\/\/technet.microsoft.com\/en-us\/library\/cc938217.aspx\">https:\/\/technet.microsoft.com\/en-us\/library\/cc938217.aspx<\/a><br \/>\nTYPE:&nbsp;&nbsp;&nbsp; REG_DWORD&nbsp;&nbsp;&nbsp; <br \/>\nVALUE:&nbsp;&nbsp;&nbsp; 0x1E 0x12C ( 30\u2013300 seconds )<br \/>\nDEFAULT:&nbsp;&nbsp;&nbsp; 0xF0 ( 240 seconds = 4 minutes ) <\/p>\n<p>\u5c06\u6b64\u503c\u8bbe\u7f6e\u4e3a\u5341\u8fdb\u5236 30\uff0c\u5176\u4e3a\u5341\u516d\u8fdb\u5236 0x0000001e\u3002\u8be5\u503c\u5c06\u7b49\u5f85\u65f6\u95f4\u8bbe\u7f6e\u4e3a 30 \u79d2\u3002 <br \/>\n\u5efa\u8bae\u503c\uff1a\u6700\u5c0f\u503c\u4e3a 0x1E\uff0c\u5b83\u5c06\u7b49\u5f85\u65f6\u95f4\u8bbe\u7f6e\u4e3a 30 \u79d2\u3002 <\/p>\n<p>\n<b>MaxUserPort \u63cf\u8ff0\uff1a<\/b><br \/>\nHKEY_LOCAL_MACHINE\/SYSTEM\/CurrentControlSet\/Services\/TCPIP\/Parameters <br \/>\nTYPE:&nbsp;&nbsp;&nbsp; REG_DWORD&nbsp;&nbsp;&nbsp; <br \/>\nVALUE:&nbsp;&nbsp;&nbsp; 5,000\u201365,534 ( port number )<br \/>\nDEFAULT:&nbsp;&nbsp;&nbsp; 5000 <\/p>\n<p>\u786e\u5b9a\u5728\u5e94\u7528\u7a0b\u5e8f\u4ece\u7cfb\u7edf\u8bf7\u6c42\u53ef\u7528\u7528\u6237\u7aef\u53e3\u65f6\uff0cTCP\/IP \u53ef\u6307\u5b9a\u7684\u6700\u9ad8\u7aef\u53e3\u53f7\u3002 <br \/>\n\u7f3a\u7701\u503c\uff1a\u65e0 \u5efa\u8bae\u503c\uff1a\u81f3\u5c11\u5341\u8fdb\u5236 32768\u3002 <\/p>\n<p><b>\u53c2\u8003\uff1a<\/b><a target=\"_blank\" href=\"https:\/\/technet.microsoft.com\/en-us\/library\/cc938196.aspx\">https:\/\/technet.microsoft.com\/en-us\/library\/cc938196.aspx<\/a><\/p>\n<p>\u6ce8\u610f: \u5982\u679c\u8c03\u6574 MaxUserPort \u6216 TcpTimedWaitDelay \u8bbe\u7f6e\uff0c\u60a8\u5fc5\u987b\u91cd\u65b0\u542f\u52a8 Microsoft Windows \u4ee5\u4f7f\u65b0\u8bbe\u7f6e\u751f\u6548\u3002<\/p>\n<p>\u4f7f\u7528 Exchange Server 2007 \uff1a<br \/>\n\u5efa\u8bae\u5c06 MaxUserPort \u503c\u8bbe\u7f6e\u4e3a 60000\u3002<br \/>\n\u5982\u679c\u8bbe\u7f6e\u7684 MaxUserPort \u503c\u4f4e\u4e8e 60000\uff0c\u670d\u52a1\u5668\u53ef\u80fd\u4f1a\u663e\u793a\u540d\u79f0\u670d\u52a1\u63d0\u4f9b\u7a0b\u5e8f\u63a5\u53e3 (NSPI) \u4ee3\u7406\u8b66\u544a\uff0c\u4f8b\u5982\u4e8b\u4ef6 9040\u3002<\/p>\n<p><a href=\"http:\/\/blogs.technet.com\/tristank\/archive\/2008\/03\/11\/maxuserport-what-it-is-what-it-does-when-it-s-important.aspx\"> <\/a><b>\u63cf\u8ff0\uff1a <\/b><\/p>\n<p><a target=\"_blank\" href=\"http:\/\/longwhiteclouds.com\/2012\/03\/22\/1-million-iops-microsoft-vs-vmware-comparison\/\">http:\/\/longwhiteclouds.com\/2012\/03\/22\/1-million-iops-microsoft-vs-vmware-comparison\/<\/a><\/p>\n<p>&nbsp;<\/p>\n<p><b>Links:<\/b><\/p>\n<p><a href=\"\/network\/572.html\" target=\"_blank\">http:\/\/www.xiaobo.li\/network\/572.html<\/a><\/p>\n<p>&nbsp;<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<div id=\"cnblogs_post_body\">\n<p>\u5f53TCP\u8fde\u63a5\u88ab\u5173\u95ed\u65f6\uff0c{ Protocol, Local IP, Local Port, Remote IP, Remote Port}\u4e94\u5143\u7ec4\u5c31\u8fdb\u5165TIME_WAIT\u72b6\u6001\uff0c\u9ed8\u8ba4\u65f6\u95f4\u662f4\u5206\u949f\u3002\u53ef\u4ee5\u901a\u8fc7\u4e00\u7ec4\u547d\u4ee4\u770b\u770btcp\u7684\u8fde\u63a5\u72b6\u6001\uff1a <\/p>\n<p>netstat -ano&gt;&gt;c:\\port.txt <\/p>\n<p>\u672c\u5730ip\uff0c\u8fdc\u7a0bip\uff0c\u8fdc\u7a0b\u7aef\u53e3\u90fd\u662f\u56fa\u5b9a\u7684\uff0c\u53ea\u6709\u672c\u5730\u7aef\u53e3\u662f\u53d8\u5316\u7684\uff0c\u672c\u5730\u7aef\u53e3\u53ea\u80fd\u4f7f\u75281024-5000\uff0c\u56e0\u6b64\u5982\u679c\u57284\u5206\u949f\u5185\u53d1\u8d77\u4e86\u5927\u7ea64000\u4e2a\u8fde\u63a5\uff0c\u8fd9\u65f6\u5c31\u4f1a\u53d1\u751f\u5f02\u5e38\uff0c\u4e0b\u9762\u662f\u4f7f\u7528WCF\uff0c\u5ba2\u6237\u7aef\u7684\u5f02\u5e38: <\/p>\n<p>System.Net.Sockets.SocketException: Only one usage of each socket<br \/>\naddress (protocol\/network address\/port) is normally permitted<br \/>\n192.168.101.5:8888 <br \/>\nat System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) <br \/>\nat System.Net.Sockets.Socket.Connect(EndPoint remoteEP) <br \/>\nat System.ServiceModel.Channels.SocketConnectio...<\/p>\n<\/div>\n<p> <a href=\"https:\/\/www.xiaobo.li\/notes\/archives\/538\">\u7ee7\u7eed\u9605\u8bfb <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[291],"tags":[],"class_list":["post-538","post","type-post","status-publish","format-standard","hentry","category-network"],"_links":{"self":[{"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/posts\/538","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/comments?post=538"}],"version-history":[{"count":0,"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/posts\/538\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/media?parent=538"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/categories?post=538"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/tags?post=538"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}