RakNet: Difference between revisions

From LRREW
Jump to navigation Jump to search
(Created page with "RakNet is the networking protocol that Roblox uses. It uses UDP as a base, and provides out-of-order delivery compensation and reliable transmission. Thank you to https://wiki.vg for hosting this information (I largely got it from [https://wiki.vg/Raknet_Protocol]) == Data Types == RakNet has specific data types. Some of them you may recognize, but there are unique types that RakNet will use {| class="wikitable" ! Type !! sizeof(Type) !! Notes |- | byte || 1 byte ||...")
 
No edit summary
 
Line 28: Line 28:
== Connection Handshake ==
== Connection Handshake ==


# Client sends the server a [[#Open Connection Request 1|Open Connection Request 1]].
# Client sends the server a [[#Open Connection Request 1 (Packet 0x05)|Open Connection Request 1]].
# Server sends the client a [[#Open Connection Reply 1|Open Connection Reply 1]].
# Server sends the client a [[#Open Connection Reply 1|Open Connection Reply 1]].
# Client sends the server a [[#Open Connection Request 2|Open Connection Request 2]].
# Client sends the server a [[#Open Connection Request 2|Open Connection Request 2]].

Latest revision as of 18:46, 1 July 2023

RakNet is the networking protocol that Roblox uses. It uses UDP as a base, and provides out-of-order delivery compensation and reliable transmission.

Thank you to https://wiki.vg for hosting this information (I largely got it from [1])

Data Types

RakNet has specific data types. Some of them you may recognize, but there are unique types that RakNet will use

Type sizeof(Type) Notes
byte 1 byte
bool 1 byte True is 0x01, false is 0x00
long 8 bytes
magic 16 bytes OFFLINE_MESSAGE_DATA_ID (00ffff00fefefefefdfdfdfd12345678?)
short/unsigned short 2
string sizeof(unsigned short) + strlen(string) bytes Strings are perl-style, which means they have a short at the beginning of the string which indicates the size of said string, and then after that contains string data
address 7 bytes First byte encodes the IP Version (4 or 6), followed by the IP address stored in bytes
uint24le 3 bytes 3-byte little-endian unsigned integer

Connection Handshake

  1. Client sends the server a Open Connection Request 1.
  2. Server sends the client a Open Connection Reply 1.
  3. Client sends the server a Open Connection Request 2.
  4. Server sends the client a Open Connection Reply 2.

The RakNet connection is established at this point, and all RakNet messages are encoded within a Frame Set Packet.

  1. Client sends the server a Connection Request.
  2. Server sends the client a Connection Request Accepted.
  3. Client sends the server a New Incoming Connection.

Packets afterwards are Game Packets.

Packets

Open Connection Request 1 (Packet 0x05)

Field Name Field Type Notes
Magic magic
Version byte I dont know what it is on Roblox
MTU Padding The server will send a MTU back around the size of this MTU's padding?