Torque2D Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Protected Attributes | List of all members
ConnectionProtocol Class Referenceabstract

`#include <connectionProtocol.h>`

Inheritance diagram for ConnectionProtocol:

## Public Member Functions
| ConnectionProtocol ()
void | buildSendPacketHeader (BitStream *bstream, S32 packetType=0)
void | sendPingPacket ()
void | sendAckPacket ()
void | setConnectionEstablished ()
bool | windowFull ()
bool | connectionEstablished ()
void | setConnectSequence (U32 connectSeq)
virtual void | writeDemoStartBlock (ResizeBitStream *stream)
virtual bool | readDemoStartBlock (BitStream *stream)
virtual void | processRawPacket (BitStream *bstream)
virtual Net::Error | sendPacket (BitStream *bstream)=0
virtual void | keepAlive ()=0
virtual void | handleConnectionEstablished ()=0
virtual void | handleNotify (bool recvd)=0
virtual void | handlePacket (BitStream *bstream)=0

## Protected Attributes
U32 | mLastSeqRecvdAtSend [32]
U32 | mLastSeqRecvd
U32 | mHighestAckedSeq
U32 | mLastSendSeq
U32 | mAckMask
U32 | mConnectSequence
U32 | mLastRecvAckAck
bool | mConnectionEstablished

## Detailed Description

The base class for Torque's networking protocol.

This implements a sliding window connected message stream over an unreliable transport (UDP). It provides a simple notify protocol to allow subclasses to be aware of what packets were sent succesfully and which failed.

Basically, a window size of 32 is provided, and each packet contains in the header a bitmask, acknowledging the receipt (or failure to receive) of the last 32 packets.

See also
  NetConnection, NetProtocol

## Constructor & Destructor Documentation

ConnectionProtocol | ( |  | ) |

## Member Function Documentation

void buildSendPacketHeader | ( | BitStream * | bstream,
|  | S32 | packetType = `0`
| ) |  |

bool connectionEstablished | ( |  | ) |

virtual void handleConnectionEstablished | ( |  | ) |
| pure virtual

Implemented in NetConnection.

virtual void handleNotify | ( | bool | recvd | ) |
| pure virtual

Implemented in NetConnection.

virtual void handlePacket | ( | BitStream * | bstream | ) |
| pure virtual

Implemented in NetConnection.

virtual void keepAlive | ( |  | ) |
| pure virtual

Implemented in NetConnection.

void processRawPacket | ( | BitStream * | bstream | ) |
| virtual

Reimplemented in NetConnection.

bool readDemoStartBlock | ( | BitStream * | stream | ) |
| virtual

Reimplemented in NetConnection.

void sendAckPacket | ( |  | ) |

virtual Net::Error sendPacket | ( | BitStream * | bstream | ) |
| pure virtual

Implemented in NetConnection.

void sendPingPacket | ( |  | ) |

void setConnectionEstablished | ( |  | ) |
| inline

void setConnectSequence | ( | U32 | connectSeq | ) |
| inline

bool windowFull | ( |  | ) |

void writeDemoStartBlock | ( | ResizeBitStream * | stream | ) |
| virtual

Reimplemented in NetConnection.

## Member Data Documentation

U32 mAckMask
| protected

bool mConnectionEstablished
| protected

U32 mConnectSequence
| protected

U32 mHighestAckedSeq
| protected

U32 mLastRecvAckAck
| protected

U32 mLastSendSeq
| protected

U32 mLastSeqRecvd
| protected

U32 mLastSeqRecvdAtSend[32]
| protected

The documentation for this class was generated from the following files:

- network/connectionProtocol.h
- network/connectionProtocol.cc