RakNet is the C++ library Facepunch uses for network communication to/from the client/server. However the RakNet version used in the game (client) as well in the server is heavily modified since RakNet is open-source.
RakNet is the "legacy" method of networking, the newer method is SteamNetworking but as of writing this, that method is rarely used, its only used if you enable it manually with a launch option.
NETRCV_Address
NETRCV_GUID
NETRCV_LengthBits
NETRCV_Port
NETRCV_RawData
NETRCV_ReadBytes
NETRCV_SetReadPointer
NETRCV_UnreadBits
NETSND_Broadcast
NETSND_ReadCompressedFloat
NETSND_ReadCompressedInt32
NETSND_ReadCompressedInt64
NETSND_Send
NETSND_Size
NETSND_Start
NETSND_WriteBytes
NETSND_WriteCompressedFloat
NETSND_WriteCompressedInt32
NETSND_WriteCompressedInt64
NET_Close
NET_CloseConnection
NET_Create
NET_GetAddress
NET_GetAveragePing
NET_GetGUID
NET_GetLastPing
NET_GetLowestPing
NET_GetReceiveBufferSize
NET_GetStatistics
NET_GetStatisticsString
NET_LastStartupError
NET_LimitBandwidth
NET_Receive
NET_SendMessage
NET_StartClient
NET_StartServer
Parameters: void* net
Returns: uint32_t
Description: Returns (uint32_t) RakNetStruct+8]+PacketStruct+4]
. This is the address of the client/server, the one you started listening on. 16777343
means 127.0.0.1 which is the loopback address, the value 16777343
is 4 byte number from which each byte is the octed of the IP address
See structure image below
Parameters: void* net
Returns: uint64_t
Description: Returns (uint64_t) RakNetStruct+8]+PacketStruct+18]
. GUID should be unique per every raknet instance, they might collide across different processes/instances
See structure image below
Parameters: void* net
Returns: int
Description: Returns (uint32_t) RakNetStruct+130]
. This is how much bits are received from the last call to NET_Receive()
Parameters: void* net
Returns: uint32_t
Description: Returns (uint16_t) RakNetStruct+8]+PacketStruct+2]
. Again this should be the local port, but its not the correct port, its some other port
See structure image below
Parameters: void* net
Returns: void*
Description: Returns (void*) RakNetStruct+140]
. This is a pointer to the data which starts at (this seems to not be true after a while/the initialization) RakNetStruct+149
which is at the end of the RakNetStruct
Parameters: void* net, void* data, int length
Returns: bool
Description: ...
Parameters: void* net, int bitsOffset
Returns: void
Description: ...
Parameters: void* net
Returns: int
Description: (uint32_t) RakNetStruct+138] - NETRCV_LengthBits()
if this is == NETRCV_LengthBits()
then just NETRCV_LengthBits()
is returned
Parameters: void* net, int priority, int reliability, int channel
Returns: uint32_t
Description: ...
Parameters: void* net
Returns: float
Description: ...
Parameters: ?
Returns: ?
Description: ...
Parameters: ?
Returns: ?
Description: ...
Parameters: void* net, uint64_t connectionID, int priority, int reliability, int channel
Returns: uint32_t
Description: ...
Parameters: void* net
Returns: uint32_t
Description: ...
Parameters: void* net
Returns: void
Description: ...
Parameters: void* net, void* data, int length
Returns: void
Description: ...
Parameters: ?
Returns: ?
Description: ...
Parameters: ?
Returns: ?
Description: ...
Parameters: ?
Returns: ?
Description: ...
Parameters: void* net
Returns: void
Description: ...
Parameters: void* net, uint64_t connectionID
Returns: void
Description: ...
Parameters: none
Returns: void*
- Ptr to raknetstruct
Description: Creates heap allocated block of 0x250 bytes. Some values are initialized to 0, 2048 and 1.
Image of how the structure looks in ReClass (name of fields are what they are initialized to)
Parameters: void* net, uint64_t connectionID
Returns: void*
Description: ...
Parameters: void* net, uint64_t connectionID
Returns: int
Description: ...
Parameters: ?
Returns: ?
Description: ...
Parameters: void* net, uint64_t connectionID
Returns: int
Description: ...
Parameters: void* net, uint64_t connectionID
Returns: int
Description: ...
Parameters: void* net
Returns: uint32_t
Description: ...
Parameters: void* net, uint64_t connectionID, RaknetStats* data, int dataLength
Returns: bool
Description: ...
Parameters: void* net, uint64_t connectionID
Returns: void*
Description: ...
Parameters: void* net
Returns: void*
Description: ...
Parameters: ?
Returns: ?
Description: ...
Parameters: void* net
Returns: bool
Description: ...
Parameters: void* net, void* data, int length, uint32_t adr, uint16_t port
Returns: void
Description: ...
Parameters: void* net, char* hostName, int port, int retries, int retryDelay, int timeout
Returns: int
Description: ...
Parameters: void* net, char* ip, int port, int maxConnections
Returns: int
Description: Initializes structures and copies ip, port and maxConnections to internal structures
NOTE: If IP is empty string it seems it binds to 0.0.0.0 which is just binding to any available IP. Usually this will be computer's IP (like: 192.168.0.170)
(not applicable to all packets, still researching)
(minecraft raknet wiki seems to be accurate to some extent)
addr | description |
---|---|
0 | raknet packet type |
1 | sequence number (packet id) |
4 | msg flags |
5 | payload len in bits |
7 | data ... |