X Protocol Definition

The X protocol is a standard protocol used by the X Window System for exchanging information about GUI (graphical user interface) operations between an X server and one or more X clients. That is, it is the message format of the X Window System.

A protocol is a mutually agreed-upon format for doing something. With regard to computers, it most commonly refers a set of rules (i.e., a standard) that enables computers to connect and transmit data to one another; this is also called a communications protocol.

The X Window System, often referred to merely as X, is a complete, cross-platform and free client-server system for managing GUIs on single computers and on networks of computers. The client-server model is an architecture (i.e., network design) that divides the work between two separate but linked applications, called clients and servers, or X clients and X servers in the case of the X window system.

The X server is a program that runs on local machines (i.e., the computers used directly by users) and handles all access to the graphics cards, display screens and input devices (typically a keyboard and mouse) on those computers for the GUIs. It also communicates with X clients, which are application programs that display on it but which can run either on the local machine or on remote machines (i.e., any other computers on the network).

As is the case with other modern communications protocols including TCP/IP (transmission control protocol/Internet protocol), which is the protocol of the Internet, X protocol is a packet-based protocol. When an X client runs on a different machine than the X server, X protocol is routed over a LAN (local area network), the Internet or some other network using a TCP/IP transport service. However, when it runs on the same machine as the X server, the fastest communications channel is Unix domain sockets (UDS), an interprocess communication mechanism that is built into Linux and other Unix-like operating systems.

Fortunately, it is rarely necessary to work directly with the X protocol. This is because X also provides xlib, which is a library of standard X tasks written in the C programming language. This library handles the low level details of using the X protocol, such as drawing primitives (e.g., lines and simple shapes), event handling (e.g., reacting to mouse movements and keyboard input) and establishing connections between the client and server over the appropriate communications channel.

Created January 1, 2006.
Copyright © 2006 The Linux Information Project. All Rights Reserved.