NAME
XConnectionNumber, ConnectionNumber — get connection number or file descriptor.
SYNOPSIS
int XConnectionNumber(display)
Display ∗display;
ARGUMENTS
displaySpecifies a connection to an X server; returned from XOpenDisplay().
RETURNS
The connection number.
DESCRIPTION
XConnectionNumber() returns the connection number for the specified display. On a POSIX-conformant system, this is the file descriptor of the connection.
The C language macro ConnectionNumber() is equivalent and slightly more efficient.
Xlib Reference Manual