xming : Client 4 rejected from IP

If you are getting following error in xming log:

Xming.exe: client 4 rejected from IP XXX.XXX.XXX.XXX

Here are two solutions.

  1. Secure method: Edit: X0.hosts (in the installation directory) and add the ip you want allow. e.g.
    localhost
    XXX.XXX.XXX.XXX
    

    Restart Xming.

  2. Insecure method: Add the “-ac” option to the Xming desktop shortcut. Modify the Desktop Xming shortcut to include the arguments: “:0 -clipboard -multiwindow -ac”. The ac option accepts client requests and quells the error above. Start Xming using the shortcut you just created. Warning: This is same as “xhost +” which will grant anyone access. So only use Xming option -ac or “xhost +” on trusted networks, never on public ones. OR use the solution 1 of additing IP address of known systems on which you will be running X applications..