Answered by:
TCP/IP failed to establish an outgoing connection Event ID 4227

Question
-
I am seeing this error in the event logs on a number of our w2012r2 servers. These servers are barely being utilized because they are not production yet. I find it hard to believe that the server is running out of ports. I did a netstat on a few servers and there are very few ports that are in use. Are there any other reasons why we would be getting this warning? Is there any other ways to troubleshoot this issue? When I do the netstat command it may be an hour after the error is logged. Its hard to catch the error and do the netstat at the same time the error is logged.
TCP/IP failed to establish an outgoing connection because the selected local endpoint was recently used to connect to the same remote endpoint. This error typically occurs when outgoing connections are opened and closed at a high rate, causing all available local ports to be used and forcing TCP/IP to reuse a local port for an outgoing connection. To minimize the risk of data corruption, the TCP/IP standard requires a minimum time period to elapse between successive connections from a given local endpoint to a given remote endpoint.
Any help is appreciated.
Thanks
Wednesday, December 16, 2015 11:59 PM
Answers
-
Hi missyz21,
Check if decrease TcpTimeWaitDelay and increase MaxUserPort could help to solve the issue.
1. The location of the TcpTimeWaitDelay is:
HKEY_LOCAL-MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters. Add REG_DWORD named TcpTimedWaitDelay, we may set the value to 30 seconds, by default, the value is 4 minutes.
Here is the detailed information about TcpTimedWaitDelay:
https://technet.microsoft.com/en-us/library/cc938217.aspx
2. Then we may use command netsh int ipv4 set dynamicport tcp start=10000 num=20000 to expand dynamic port range.
Best Regards,
Anne
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.
- Proposed as answer by Anne HeMicrosoft contingent staff Tuesday, December 29, 2015 9:07 AM
- Marked as answer by Anne HeMicrosoft contingent staff Wednesday, January 6, 2016 1:52 AM
Thursday, December 17, 2015 6:37 AM
All replies
-
Maybe the script here helps you determine the cause.
Regards, Dave Patrick ....
Microsoft Certified Professional
Microsoft MVP [Windows]
Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.- Proposed as answer by Anne HeMicrosoft contingent staff Tuesday, December 29, 2015 9:07 AM
Thursday, December 17, 2015 12:27 AM -
Hi missyz21,
Check if decrease TcpTimeWaitDelay and increase MaxUserPort could help to solve the issue.
1. The location of the TcpTimeWaitDelay is:
HKEY_LOCAL-MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters. Add REG_DWORD named TcpTimedWaitDelay, we may set the value to 30 seconds, by default, the value is 4 minutes.
Here is the detailed information about TcpTimedWaitDelay:
https://technet.microsoft.com/en-us/library/cc938217.aspx
2. Then we may use command netsh int ipv4 set dynamicport tcp start=10000 num=20000 to expand dynamic port range.
Best Regards,
Anne
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.
- Proposed as answer by Anne HeMicrosoft contingent staff Tuesday, December 29, 2015 9:07 AM
- Marked as answer by Anne HeMicrosoft contingent staff Wednesday, January 6, 2016 1:52 AM
Thursday, December 17, 2015 6:37 AM -
How did you solve the problem?Wednesday, November 9, 2016 8:12 AM
-
What would be happening that would cause you to have to make a change in this setting?
Did this fix your problem?
Tuesday, March 28, 2017 1:43 PM -
One of my user was also getting same error on his win 7 machine. While troubleshooting, i narrowed it down to Citrix receiver. He was using receiver to connect to his win 7 via RDP.
I just wanted to post it here as it may help someone with similar error.
Monday, September 25, 2017 3:22 PM -
Hi,
Have IIS web server that keeps losing network and failing to accept new connections to DB through application. AD authentication also fails at the same time. Digging through logs shows the Tcpip event 4227 to be the root of this. Looking at your recommended solution, step 1 seems a plausible solution. However step 2 requiring change of dynamic port range doesn't seem so much. How does dynamic port range relate to this?
Thursday, October 19, 2017 10:07 AM -
Hi,
I know this is an old thread but I just wanted to enquire as to how you resolved this one? I have a user on a Win 10 host that is receiving the loss of TCP/IP 2/3 times a day for 45 seconds at a time.
Struggling to determine the cause but we do use have citrix receiver on our builds so wondered how you determined that was the cause in your case?
Thanks,
Friday, June 12, 2020 11:13 AM