Exifers
Exifers

Reputation: 2822

How does a program communicate with the X11 Server on Linux?

So I made quite a lot of research about this and couldn't find the answer.

Does it use a named pipe ? a socket on localhost ? d-bus ?

Can I intercept and see the binary messages sent by an X client to the X server with a line of bash ?

Of course this is only for educational purpose. I don't intend to build a software that would intercept such messages.

Upvotes: 3

Views: 3743

Answers (2)

To add to the other answer, there is also TCP/IP. In fact, a program can use an X11 server running on a totally different machine, even traveling the world.

You can use for example:

DISPLAY=192.168.1.56:0 xterm

and the program xterm(1) will connect to the machine indicated by $DISPLAY using a TCP/IP connection.

Upvotes: 5

datenwolf
datenwolf

Reputation: 162164

It uses a Unix domain socket, of the name /tmp/.X11-unix/X${DISPLAYNUMBER}. These days Linux support a special naming for Unix domain sockets, called "abstract namespace UDS", where the path is prepended with an @, but is otherwise the same.

Upvotes: 6

Related Questions