I use VNC to remotely access the screen/keyboard of my MacBook Pro, running the latest version of OSX. Intermittently (which is annoying) the keyboard stops working, and at this time the mouse is still working fine.

More interestly when I bring up the virtual keyboard (as I can do this with the mouse) and hit some keys, then this doesn't work either.

Any ideas why/when/how my MacBook may stop responding to keyboard presses from (a) remote PC using VNC to access and (b) the virtual keyboard?

Any fault finding ideas?