Overview
Connection packets handle the initial handshake between clients and servers, including authentication, join requests, and disconnect notifications.FSNETCMD_LOGON
Packet ID:1 | Direction: Client → Server (Server → Client for acknowledgment)
Sent by clients to log into a server. The server replies with an empty LOGON packet to acknowledge successful login.
Location
lib/PacketManager/packets/FSNETCMD_LOGON.py
Fields
Player’s username (max 16 characters in short form)
YSFlight version identifier for compatibility checking
Full username if longer than 16 characters, otherwise same as username
Methods
Decodes the LOGON packet into readable fieldsExample:
Creates a LOGON packetParameters:
username(str): Player usernameversion(int): YSFlight version numberwith_size(bool): Include size header
bytes - Encoded packetExample:Modifies the version number in an existing LOGON packetParameters:
buffer(bytes): Original packet datanew_version(int): New version number
bytes - Modified packetExample:Usage Example
FSNETCMD_LOGOFF
Packet ID:2 | Direction: Client → Server
Sent when a client logs off from the server. Appears to be unused by YSFlight in practice.
Location
lib/PacketManager/packets/FSNETCMD_LOGOFF.py
Fields
No payload - empty packet.Methods
Creates a LOGOFF packetExample:
FSNETCMD_JOINREQUEST
Packet ID:8 | Direction: Client → Server (Server → Client for readback)
Sent by clients to request joining the simulation with a specific aircraft and starting position.
Location
lib/PacketManager/packets/FSNETCMD_JOINREQUEST.py
Fields
IFF (Identification Friend or Foe) team identifier. Note: The value sent is 1 less than the player’s selected IFF.
Aircraft identifier/name (max 32 characters)
Starting position identifier (STP name, max 32 characters)
Initial fuel amount
Initial smoke configuration
Methods
Decodes the join request packetExample:
Creates a JOINREQUEST packetParameters:
iff(int): Team identifieraircraft(str): Aircraft namestart_pos(str): Starting positionfuel(int): Initial fuelsmoke(int): Smoke configurationwith_size(bool): Include size header
Usage Example
Aircraft Replacement Plugin Example
FSNETCMD_JOINAPPROVAL
Packet ID:9 | Direction: Server → Client
Sent by the server after receiving the readback from the client’s ADDOBJECT packet. Signals that the client is approved to join.
Location
lib/PacketManager/packets/FSNETCMD_JOINAPPROVAL.py
Fields
No payload - empty packet.Methods
Creates a JOINAPPROVAL packetExample:
Join Sequence
The complete join sequence is:- Client sends JOINREQUEST to server
- Server sends ADDOBJECT to client (add your aircraft)
- Client sends READBACK acknowledging ADDOBJECT
- Server sends JOINAPPROVAL ← This packet
- Client officially enters the simulation
FSNETCMD_REJECTJOINREQ
Packet ID:10 | Direction: Server → Client
Sent by the server to reject a join request.
Location
lib/PacketManager/packets/FSNETCMD_REJECTJOINREQ.py
Usage
Connection Flow Diagram
Version Compatibility
YSFlight uses version numbers to ensure client-server compatibility:- 20180930: YSFlight 2018 / YSCE
- 20191124: YSFlight 20191124
- Older versions: May not be compatible
FSNETCMD_LOGON.alter_version() to maintain compatibility.