|
3rd Eye Scene C#
3rd Eye Scene C# documentation
|
A utility class for encoding CollatedPacketMessage packets, including compression. More...
Public Member Functions | |
| CollatedPacketEncoder (bool compress, int initialBufferSize=64 *1024) | |
| Create an encoder with the target initial buffer size. | |
| void | Reset () |
| Reset the buffer to start again. | |
| int | Add (PacketBuffer packet) |
| Add the given packet. | |
| int | Add (byte[] bytes, int offset, int length) |
| Add bytes from the given buffer. | |
| bool | FinaliseEncoding () |
| Finalise the collated packet before sending. | |
| void | Close () |
| Ignored. | |
| int | UpdateFrame (float dt, bool flush) |
| Not supported. | |
| int | Create (Shape shape) |
| Send the create message for shape . | |
| int | Destroy (Shape shape) |
| Send the create message for shape . | |
| int | Update (Shape shape) |
| Send the create message for shape . | |
| bool | SendServerInfo (ServerInfoMessage info) |
| Sends the ServerInfoMessage structure to the connected client. | |
| int | Send (byte[] bytes, int offset, int length) |
| Sends data on the client connection. | |
| uint | GetReferenceCount (Resource resource) |
| Not supported for packet collation. | |
| uint | AddResource (Resource resource) |
| Not supported for packet collation. | |
| uint | RemoveResource (Resource resource) |
| Not supported for packet collation. | |
Protected Member Functions | |
| void | SetPayloadSize (ushort size) |
| Sets the PacketHeader.PayloadSize value. | |
| void | SetUncompressedBytesSize (uint size) |
| Sets the CollatedPacketMessage.UncompressedBytes value. | |
| void | WriteHeaderData (int dstOffset, byte[] bytes) |
| Write data into the header section at the given offset. | |
Properties | |
| static int | Overhead [get] |
| Byte count overhead added by using a collated packet. | |
| static ushort | MaxPacketSize [get] |
The default packet size limit for a CollatedPacketMessage. | |
| bool | CompressionEnabled [get, set] |
| True if created with compression. | |
| byte[] | Buffer [get] |
| Direct access to the internal buffer bytes. | |
| int | Count [get] |
| The total number of bytes written to Buffer. | |
| int | CollatedBytes [get, set] |
| The number of bytes written to Buffer excluding the Overhead. | |
| string | Address [get] |
| Identifies as "CollatedPacket". | |
| int | Port [get] |
| Always zero. | |
| bool | Connected [get] |
| Always true. | |
A utility class for encoding CollatedPacketMessage packets, including compression.
Typical usage:
See CollatedPacketDecoder for notes on why
System.IO.Compression
is not used.
Derives the IConnection interface for compatibility.
| Tes::IO::CollatedPacketEncoder::CollatedPacketEncoder | ( | bool | compress, |
| int | initialBufferSize = 64 * 1024 |
||
| ) | [inline] |
Create an encoder with the target initial buffer size.
| compress | True to compress collated data. |
| initialBufferSize | The initial buffer size (bytes). |
| int Tes::IO::CollatedPacketEncoder::Add | ( | PacketBuffer | packet | ) | [inline] |
Add the given packet.
| packet | The buffer to collate. |
| int Tes::IO::CollatedPacketEncoder::Add | ( | byte[] | bytes, |
| int | offset, | ||
| int | length | ||
| ) | [inline] |
Add bytes from the given buffer.
| bytes | Buffer to add from. |
| offset | Offset to the first byte in bytes to add. |
| length | Number of bytes from buffer to add. |
| uint Tes::IO::CollatedPacketEncoder::AddResource | ( | Resource | resource | ) | [inline] |
Not supported for packet collation.
Throws NotSupportedException.
| resource |
Implements Tes::Net::IConnection.
| int Tes::IO::CollatedPacketEncoder::Create | ( | Shape | shape | ) | [inline] |
| int Tes::IO::CollatedPacketEncoder::Destroy | ( | Shape | shape | ) | [inline] |
| bool Tes::IO::CollatedPacketEncoder::FinaliseEncoding | ( | ) | [inline] |
Finalise the collated packet before sending.
| uint Tes::IO::CollatedPacketEncoder::GetReferenceCount | ( | Resource | resource | ) | [inline] |
Not supported for packet collation.
| resource |
Implements Tes::Net::IConnection.
| uint Tes::IO::CollatedPacketEncoder::RemoveResource | ( | Resource | resource | ) | [inline] |
Not supported for packet collation.
Throws NotSupportedException.
| resource |
Implements Tes::Net::IConnection.
| int Tes::IO::CollatedPacketEncoder::Send | ( | byte[] | bytes, |
| int | offset, | ||
| int | length | ||
| ) | [inline] |
Sends data on the client connection.
Aliases Add(byte[], int, int).
| bytes | The data buffer to send. |
| offset | An offset into bytes at which to start sending. |
| length | The number of bytes to transfer. |
Implements Tes::Net::IConnection.
| bool Tes::IO::CollatedPacketEncoder::SendServerInfo | ( | ServerInfoMessage | info | ) | [inline] |
Sends the ServerInfoMessage structure to the connected client.
| info | The info message to send. |
Implements Tes::Net::IConnection.
| void Tes::IO::CollatedPacketEncoder::SetPayloadSize | ( | ushort | size | ) | [inline, protected] |
Sets the PacketHeader.PayloadSize value.
| size | The packet payload size (compressed). |
| void Tes::IO::CollatedPacketEncoder::SetUncompressedBytesSize | ( | uint | size | ) | [inline, protected] |
Sets the CollatedPacketMessage.UncompressedBytes value.
| size | The number of uncompressed in the payload. |
| int Tes::IO::CollatedPacketEncoder::Update | ( | Shape | shape | ) | [inline] |
| int Tes::IO::CollatedPacketEncoder::UpdateFrame | ( | float | dt, |
| bool | flush | ||
| ) | [inline] |
| void Tes::IO::CollatedPacketEncoder::WriteHeaderData | ( | int | dstOffset, |
| byte[] | bytes | ||
| ) | [inline, protected] |
Write data into the header section at the given offset.
| dstOffset | Buffer offset to write at. |
| bytes | Bytes to write. |
byte [] Tes::IO::CollatedPacketEncoder::Buffer [get] |
Direct access to the internal buffer bytes.
Intended to aid in serialisation of completed packets. For example:
writer.Send(packet.Buffer, 0, packet.Count)
Use with care.
int Tes::IO::CollatedPacketEncoder::Overhead [static, get] |
Byte count overhead added by using a collated packet.
This is the sum of PacketHeader, CollatedPacketMessage and the Crc16 value type.