3 Tested Solution to Fix VNC The Connection Closed Unexpectedly
VNC “The connection closed unexpectedly” often happens to VNC Viewer when trying to connect to VNC Server. Don’t worry. This post provides three tested solutions to fix it. Continue reading if you've come across this problem.
VNC Viewer: The connection closed unexpectedly
When connecting to a VNC Server, the VNC Viewer is unable to connect, and shows this message, ‘Connection closed unexpectedly’. What are the causes of this occurrence, and what steps can be taken to resolve it?”
- Question from Reddit
What causes VNC “The connection closed unexpectedly”?
VNC “The connection closed unexpectedly” is a typical VNC Viewererror, applying to TightVNC, TigerVNC, RealVNC, etc. To fix this issue, you’ll first need to figure out what causes this error.
If you encounter the VNC connection closed unexpectedly, several potential factors may be responsible for this issue.
- VNC Server is blocking your connection attempt;
- When the remote computer, which is running Windows, has a full Event Log.
- The private key of the VNC Server is either missing or corrupted.
How to fix VNC “The connection closed unexpectedly”[3 solutions]
Once you have a clear understanding of the reasons behind the occurrence of the VNC Viewer “The connection closed unexpectedly” error, you can proceed with the following troubleshooting measures. These steps will help you address the issue effectively.
Solution 1. Make sure your IP address is not blocked
When VNC Server is blocking your connection attempt, this error shows up. To resolve the issue, check the VNC Server IpClientAddresses parameter on the remote computer and ensure that it is not blocking the IP address of your computer. You can follow these steps:
Step 1. Locate VNC Server on the toolbar, right-click on it, and select the "Options" menu.
Step 2. Go to Expert, and find IpClientAddresses. Specify an ordered, comma-separated list of actions and network addresses, in each of the forms:
(action)(ip address-or-range)
Where (action) is either:
- + value permits direct connections
- - value rejects direct connections
- ? value flags direct connections
(ip address-or-range) can represent either a specific IP address or a range denoted by a forward slash (/). In the case of a range, it can be followed by a subnet mask (e.g., 192.168.0.187/255.255.0.0) or the number of bits in the routing prefix (e.g., 192.168.0.187/24).
Example: +192.168.0.1,?192.168.4.0/255.255.255.0,-
- The first entry allows direct connections from a VNC Viewer computer having the IP address 192.168.0.1.
- The second entry indicates that direct connections from any VNC Viewer computer within the 192.168.4 subnet are flagged.
- The third entry denies direct connections from any other VNC Viewer computers.
You’ll need to make sure your IP address is allowed. If not, you can add your IP address explicitly to the parameter.
Solution 2. Check whether the Event Log is full
If the Event Log is full, the problem happens. Follow the steps below to check.
Step 1. On the remote computer, search for Event Viewer in the search box and click Run as administrator.
Step 2. Next, navigate to Windows Logs, select Application, and choose Clear Log.
Step 3. Lastly, access the Properties menu and choose to overwrite events as necessary.
Solution 3. Regenerate the private key
You have two options if the problem is caused by the VNC Server’s private key being missing or corrupt. The first one is to restart VNC Server, which will automatically generate a new private key. Alternatively, you can use the command line by running "-service -generatekeys" without the need to restart the server.
Bonus tip: Free & safe VNC alternative - AnyViewer
If you're looking for a VNC alternative, it's highly recommended to explore other options available in the market. There is a wide range of alternatives to VNC that you can consider. However, in this context, we would like to introduce you to AnyViewer, a professional and cost-free remote access software designed specifically for Windows computers. So, what makes AnyViewer the best VNC alternative for Windows?
One of the notable advantages of AnyViewer is that it encompasses all the advantages that VNC offers. On top of that, it addresses the limitations associated with VNC, providing an enhanced remote access experience. Here are some key features that set AnyViewer apart:
- Completely free for either private or commercial uses.
- Support for multiple monitors, allowing you to seamlessly manage and control multiple displays.
- Optimized bandwidth usage, enabling you to choose high resolutions without compromising network performance.
- Developed by a highly skilled technical team, AnyViewer ensures a fast and stable connection for its users.
By choosing AnyViewer as your VNC alternative, you gain access to a reliable and efficient remote access solution that not only retains the benefits of VNC but also overcomes its drawbacks.
Step 1. Download, install, and launch AnyViewer on both your work and home computer. On the Controller computer, go to Log in, and then click Sign up. (If you already have signed up on its official website, you can log in directly.)
Step 2. Fill in the signup information.
Step 3. Then you can see you successfully logged in to AnyViewer. Your device will automatically be assigned to the account you’ve logged in to.
Step 4. Log in to the same AnyViewer account on the two devices, then you can achieve a direct connection by clicking One-click control to achieve unattended remote support.
Step 5. After connecting successfully, you’ll see the remote desktop. Then you can completely control it and provide remote support just like you’re sitting in front of it.
- Notes:✎...
- You can also upgrade your account to a Professional or Enterprise plan. What can a professional or enterprise plan brings to you:
- More devices can be assigned to the same account for unattended remote support.
- Connect in privacy mode to protect privacy, which means the Controller can black the remote PC screen and disable the remote keyboard & mouse click.
- Faster file transfer speed. Transfer speed for a free account is 500 KB/s, and for a paid account is up to 10 MB/s.
The bottom line
In this post, we present a proven method to address the frustrating issue of encountering the VNC "The connection closed unexpectedly". By understanding the underlying causes, resolving this error becomes a simpler task. By following the provided solution steps diligently, you can expect to overcome this problem.
However, if you find that the issue persists despite attempting the aforementioned solutions, we strongly advise considering AnyViewer as a viable alternative to VNC. AnyViewer serves as a reliable remote desktop tool that ensures a seamless and error-free experience. Don't hesitate to give it a try and experience its benefits firsthand.