Skip to content

Network Information

Jason Watkins edited this page Jul 27, 2015 · 21 revisions

The X-Plane Connect network protocol is designed to extend the UDP data protocol provided by X-Plane. XPC's protocol is a strict superset of the X-Plane protocol.

Detailed information about the commands added by XPC are provided below.

The primary purpose of this page is to document the format of data as it travels over the network. For more information about the commands themselves, there is usually an obvious one-to-one mapping between these datagrams and commands described in the XPC Client Reference.

#Format

The following section describes commands using the following format:

Each command is presented as a table with 3 rows. The first row shows the byte number of the packet. The second row indicates the type of the data field. Finally, the third row gives a descriptor of the field. Interesting descriptors are described in more detail below the table. The first 4 bytes of each command are always ASCII characters, and their descriptors are character literals.

Symbol Data Type
x Padding byte
C ASCII Character
B Byte
U16 Unsigned 16-bit integer
U32 Unsigned 32-bit integer
U64 Unsigned 64-bit integer
I16 Signed 16-bit integer
I32 Signed 32-bit integer
I64 Signed 64-bit integer
F 32-bit float
D 64-bit float
S ASCII string

####Strings ASCII strings are always preceded by a single byte indicating their length. Strings are not null terminated.

####Byte Order All multi-byte fields are transmitted in little-endian byte order.

#Commands

###Quick Nav CONF | CONN | CTRL | DATA | DREF | GETC | GETD | GETP | PLAY | POSI | RECD | RESP | SIMU | TEXT | WYPT

##CONF Summary: Sent in response to the CONN command on the new port.

Format:

0 1 2 3 4 5
C C C C x B
C O N F - id

id: The internal id of the client. Because this value is not exposed to the client anywhere else, it is not actually useful. It is kept for legacy compatibility.

##CONN Summary: Sets the port used to send data back to the sending client.

Format:

0 1 2 3 4 5
C C C C x U16
C O N N - port

port: The port on which future data will be sent.

##CTRL Summary: Sets the control surfaces of the specified aircraft.

Format:

0 1 2 3 4 5 9 13 17 21 22 26 27
C C C C x F F F F B F B F
C T R L - e a r t g f ac sb

e: Elevator. Value should be in the range [-1, 1].

a: Aileron. Value should be in the range [-1, 1].

r: Rudder. Value should be in the range [-1, 1].

t: Throttle. Value should be in the range [0, 1].

g: Gear. Value should be 0, 1, or -1 (-1 toggles).

f: Flaps. Value should be in the range [0, 1].

ac: Aircraft number.

sb: Speed brakes. Value should be in the range [-0.5, 1.5].

##DATA Summary: Sets data rows.

Format:

0 1 2 3 4 5 9 ... 37 ...
C C C C x U32 F F F -
D A T A - r1 v1^1 ... v1^8 ...

The DATA command consists of any number of rows. No length byte is used; the length is determined by dividing the packet length by 36 instead.

##DREF Summary: Sets the value of an X-Plane dataref.

Format:

0 1 2 3 4 5 6 6+n 7+n ... 7+n+4(m-1)
C C C C x B S B F F F
D R E F - n dref m v^1 ... v^m

n: The length of dref.

dref: The name of the dataref being set.

m: The number of values in the dataref.

v^1 to v^m: The values of the dataref.

##GETC Summary: Sends a request to the plugin to get the control surface information for a specific plane. The plugin will respond with a CTRL packet.

Format:

0 1 2 3 4 5
C C C C x B
G C T L - n

n: The aircraft number to get information for.

##GETD Summary: Gets the value of one or more datarefs. This command's structure is difficult to represent in tabular form, but is fairly straightforward in practice. In short, the command has the standard header, followed by the number of datarefs being requested, followed by the dataref names.

Format:

0 1 2 3 4 5 6 7 7+n^1+1 ... Complicated
C C C C x B B S B S B S
G E T D - c n^1 dref^1 ... ... n^c dref^c

c: The number of datarefs.

n^1 to n^c: The length of each dref.

dref^1 to dref^c: The name of each dataref.

##GETP Summary: Sends a request to the plugin to get the position of a specific plane. The plugin will respond with a POSI packet.

Format:

0 1 2 3 4 5
C C C C x B
G P O S - n

n: The aircraft number to get information for.

##PLAY Summary: Controls the recording and replaying of playback files.

Format:

0 1 2 3 4 5 6 7
C C C C x B B S
P L A Y - op len path

op: The operation to perform len: The length of path path: The location to save or read the playback file.

##POSI Summary: Sets the position and orientation of an aircraft

Format:

0 1 2 3 4 5 6 10 14 18 22 26 30
C C C C x B F F F F F F F
P O S I - ac lat lon el r p h g

ac: Aircraft number. lat: Latitude lon: Longitude el: Elevation (meters above sea level) r: Roll (degrees) p: Pitch (degrees) r: Roll (degrees) h: Heading (degrees) g: Gear (0 to retract, 1 to extend)

##RESP Summary: Returns value of one or more datarefs in response to the GETD command. This command's structure is difficult to represent in tabular form, but is fairly straightforward in practice. In short, the command has the standard header, followed by the number of datarefs that were requested requested, followed by the data itself

Format:

0 1 2 3 4 5 6 7 Complicated
C C C C x B B F[] ...
G E T D - c n^1 data^1 ...

c: The number of datarefs.

n^1 to n^c: The number of values in the result.

data^1 to data^c: The result for each data ref. Values are always float, even if the actual type of the dataref is int or double.

##SIMU Summary: Enables or disables the physics simulation in X-Plane.

Format:

0 1 2 3 4 5
C C C C x B
S I M U - op

op: The operation to perform. 0 disables physics, 1 enables, and 2 toggles.

##TEXT Summary: Sends a string to be drawn on the screen.

Format:

0 1 2 3 4 5 9 13 14
C C C C x I32 I32 B S
S I M U - x y n str

x: The x coordinate where the string will be drawn.

y: The y coordinate where the string will be drawn.

n: The length of the string. Setting this to 0 will clear the current string and disable drawing.

str: The string itself.

##VIEW Summary: Changes the camera mode in X-Plane

Format:

0 1 2 3 4 5
C C C C x I32
V I E W - type

type: The command key associated with the desired view.

##WYPT Summary: Manipulates a sequence of waypoints drawn in the world.

Format:

0 1 2 3 4 5 6 7 ... 6+4(3n-1)
C C C C x B B F F F
W Y P T - op n v^1 ... v^3n

op: The operation to perform. 1 to add, 2 to remove, 3 to clear.

n: The number of points.

v^1 to v^3n: Values representing each point. Each triplet in this sequence is treated as a (lat, lon, alt) point.