pub struct Handshake {
    pub network_version: u32,
    pub service_id: ServiceId,
    pub process_id: u32,
    pub port: u16,
}
Expand description

Provides the client’s network version.

Allows to identify outdated clients and disconnect them early.

Trigger

Establishment of raknet connection (receipt of ConnectionRequestAccepted).

Handling

Check if network_version matches the version you expect. Otherwise, disconnect the client, ideally with a DisconnectNotify::InvalidGameVersion specifying the expected version.

Response

Respond with a server-sent Handshake providing the server’s network version and service ID.

Notes

This packet should not be seen as proof that the client’s network version is actually what they report it to be. The client can provide any value, and malicious clients can deviate from the protocol in any way they like. Therefore, proper length and value checking is still required for packet parsing, and care should be taken that your server does not crash on invalid input. If you’re using the parsing functionality of this library, this will be taken care of for you.

Fields

network_version: u32

The network protocol version of the client. For unmodified live clients, this is 171022. This was relevant mainly back when LU was actively updated. If you intend to make modifications to the protocol for your server project, you should change this to a different value.

service_id: ServiceId

Service ID of the client, always ServiceId::Client. LU used this packet for all service communications, including server-to-server, which is the reason it’s necessary to specify this.

process_id: u32

Process ID of the client.

port: u16

Local port of the client, not necessarily the same as the one the connection is from in case of NAT.

Trait Implementations

Formats the value using the given formatter. Read more
Deserializes the type by reading from the reader.
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
Serializes the type by writing to the writer.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.