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.

  1. Server sends a HelloPacket with version information
  2. Client responds with SetTypePacket containing connection type
  3. Server stores connection type and sends HandshakePacket containing version and registry
  4. Client updates own registry based on packet and sends HandshakeAcceptPacket
  5. 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.

  1. close_connection() is called
  2. CloseConnectionPacket is sent to peer and internal flag is set
  3. After packet has been fully sent, event handlers are called
  4. Peer receives packet and calls event handlers
  5. 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.

class peng3dnet.packet.internal.HandshakeAcceptPacket(reg, peer, obj=None)[source]

Internal packet sent by the client to indicate a successful handshake.

Once this packet has been sent or received, the connection is established and can be used.

class peng3dnet.packet.internal.CloseConnectionPacket(reg, peer, obj=None)[source]

Internal packet to be sent to indicate that a connection is about to be closed.

Usually includes a reason in the reason field.

This packet can be sent at any time, regardless of connection state or type.