How do I connect to remote x server in my program?

by benedict_jo   Last Updated September 25, 2019 12:01 PM - source

On Windows, I played with putty and xming and it works. Also Mac XQuartz works. Now I want to have my own program exhibit locally just like xclock.

Here I am stuck. XOpenDisplay(null) in my program should connect to putty and xming without me doing anything. I either get seg faults or I get null.

Another way would be to not use putty for x forwarding and rely on my settings. I play directly with DISPLAY and set it to local IP address but never is my program get connected. Either it breaks on the XOpenDisplayor null is returned.

Yet another way to test this would be to call XOpenDisplay("") and expect xming to pop my own window, but I get segmentation fault.

What is preventing the connection to the extent that XOpenDisplay crashes?

If you know the precise cook book recipe for Ubuntu 19 that will show what to do, it would be awesome. I am sure millions have had to deal with this issue.

Thank you.

Related Questions

Highlight windows shown via X-forwarding on SSH

Updated July 06, 2017 14:01 PM

Accessing an OpenGL GUI through X11 forwarding

Updated August 15, 2017 17:01 PM

Duplicate invocation on display number: 0

Updated July 25, 2018 13:01 PM