I'm attempting to remotely access the desktop of my Raspberry Pi 2 using VNC. I followed these instructions to install TightVNC Server on the Pi (which is running NOOBS) and these instructions to install TightVNC Viewer on a PC running Windows 7.

I'm specifying 192.168.#.#:1 or 192.168.#.#::5901 as the remote host in the "New TightVNC Connection" dialog, where 192.168.#.# is the IP address of the Pi determined using hostname -I. With either of these, the connection sometimes succeeds but sometimes fails with the error:

"Error in TightVNC Viewer: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond."

I've also tried connecting to the Pi using telnet 192.168.#.# 5901; similarly, this sometimes works and sometimes doesn't (when it doesn't work, the error is, "Could not open connection to the host, on port 5901: Connect failed").

Generally, I'll be able to connect successfully for a while, then connection attempts will fail, followed by a period where they succeed again, etc. (All using the same vncserver session on the Pi.)

Any suggestions about what might be causing this behaviour would be appreciated!

EDIT: during a period when connection attempts fail, it seems that loading something over the network on the Pi's end (e.g., visiting a new web page in the Epiphany web browser) will result in connection attempts succeeding again (but only for a while).

For example, if I start pinging the Pi (via ping 192.168.#.# in the Windows command prompt) during a period when connection attempts fail, the result is "Request timed out". If I visit a website on the Pi while Windows is still pinging it (e.g., between the second and third pings), the result of the next ping attempt will be "Reply from 192.168.#.#: bytes=32 [...]" and a subsequent VNC connection attempt will succeed.

  • When you can't connect from your PC, can you ping the PI from the PC? – Kolban Jun 18 '16 at 2:35
  • @Kolban if I ping the Pi during a period when connection attempts fail, the ping request times out. If I ping the Pi during a period when connection attempts succeed, the ping elicits a reply. – Reign of Error Jun 18 '16 at 15:14
  • 1
    As an educated guess, I would suggest that the WiFi device is suspending itself due to lack of activity. Have a google search on this notion as it relates to the Raspberry Pi. There are settings available where the WiFi device can be prevented from going to sleep. – Kolban Jun 18 '16 at 16:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.