[...]

Connection Setup
       For remote clients, the X protocol can be built on top of
       any reliable byte stream.

Connection Initiation
       The client must send an initial byte of data to identify
       the byte order to be employed.  The value of the byte must
       be octal 102 or 154.  The value 102 (ASCII uppercase B)
       means values are transmitted most significant byte first,
       and value 154 (ASCII lowercase l) means values are trans-
       mitted least significant byte first.  Except where explic-
       itly noted in the protocol, all 16-bit and 32-bit quanti-
       ties sent by the client must be transmitted with this byte
       order, and all 16-bit and 32-bit quantities returned by
       the server will be transmitted with this byte order.

       Following the byte-order byte, the client sends the fol-
       lowing information at connection setup:

	      protocol-major-version: CARD16
	      protocol-minor-version: CARD16
	      authorization-protocol-name: STRING8
	      authorization-protocol-data: STRING8

       The version numbers indicate what version of the protocol
       the client expects the server to implement.

       The authorization name indicates what authorization (and
       authentication) protocol the client expects the server to
       use, and the data is specific to that protocol.	Specifi-
       cation of valid authorization mechanisms is not part of
       the core X protocol.  A server that does not implement the
       protocol the client expects or that only implements the
       host-based mechanism may simply ignore this information.
       If both name and data strings are empty, this is to be
       interpreted as ``no explicit authorization.''

Server Response
       The client receives the following information at connec-
       tion setup:

	      success:

       The client receives the following additional data if the
       returned success value is and the connection is not suc-
       cessfully established:

	      protocol-major-version: CARD16
	      protocol-minor-version: CARD16
	      reason: STRING8

       The client receives the following additional data if the
       returned success value is and further authentication nego-
       tiation is required:

	      reason: STRING8

       The contents of the reason string are specific to the
       authorization protocol in use.  The semantics of this
       authentication negotiation are not constrained, except
       that the negotiation must eventually terminate with a
       reply from the server containing a success value of or

       [...]