peng3dnet.packet.internal
- Internal Packet Classes¶
This module contains various internal packets not intended for direct use.
These packets will be registered by the default implementations of client and
server classes with names starting with peng3dnet:
. Any other packets whose
name starts with peng3dnet:
may be processed incorrectly.
Additionally, packets within this module usually use reserved and static packet IDs below 16.
Handshake¶
Note that if a custom connection type is used, any steps after step 3. may be left out.
- Server sends a
HelloPacket
with version information - Client responds with
SetTypePacket
containing connection type - Server stores connection type and sends
HandshakePacket
containing version and registry - Client updates own registry based on packet and sends
HandshakeAcceptPacket
- Server receives packet and calls event handler to signal a successful handshake
Connection shutdown¶
Note that this only applies to clean shutdowns caused by close_connection()
or its client-side equivalent.
close_connection()
is calledCloseConnectionPacket
is sent to peer and internal flag is set- After packet has been fully sent, event handlers are called
- Peer receives packet and calls event handlers
- Server cleans up internal data structures
-
class
peng3dnet.packet.internal.
HelloPacket
(reg, peer, obj=None)[source]¶ Internal packet sent by the server to initialize a handshake.
This is usually the first packet transmitted by every connection. It contains version information for the client to check.
If the client does not support the given protocol version, the connection must be aborted with the reason
protoversionmismatch
.
-
class
peng3dnet.packet.internal.
SetTypePacket
(reg, peer, obj=None)[source]¶ Internal packet sent by the client to indicate the connection type.
If the server does not recognize the connection type, the connection must be aborted with the reason
unknownconntype
.If no connection type is supplied,
classic
is substituted.
-
class
peng3dnet.packet.internal.
HandshakePacket
(reg, peer, obj=None)[source]¶ Internal packet sent by the server to synchronize the registry.
Additionally, the version information is sent and checked.
If the
net.registry.autosync
config value is true, the registry sent by the server will be adapted to the client.Note that only IDs are synced to names, objects will not be affected.