C# 클래스 NetworkCommsDotNet.Tools.PacketBuilder

Packet data is generally broken into multiple variable sized byte chunks or 'partial packets'. This class provides features to effortlessly rebuild whole packets.
파일 보기 프로젝트 열기: MarcFletcher/NetworkComms.Net 1 사용 예제들

공개 메소드들

메소드 설명
AddPartialPacket ( int packetBytes, byte partialPacket ) : void

Add a partial packet to the end of the cache by reference.

ClearNTopBytes ( int numBytesToRemove ) : void

Clear N bytes from cache, starting with oldest bytes first.

FirstByte ( ) : byte

Returns the value of the first cached byte.

GetAllData ( ) : byte[]

Copies all cached bytes into a single array and returns. Original data is left unchanged.

NumUnusedBytesMostRecentPartialPacket ( ) : int

Returns the number of unused bytes in the most recently cached partial packet.

PacketBuilder ( ) : System

Create a new instance of the ConnectionPacketBuilder class

ReadDataSection ( int startIndex, int length ) : MemoryStream

Copies the requested cached bytes into a single array and returns. Original data is left unchanged.

RemoveMostRecentPartialPacket ( int &lastPacketBytesRead ) : byte[]

Returns the most recently cached partial packet and removes it from the cache. Used to more efficiently utilise allocated memory space.

메소드 상세

AddPartialPacket() 공개 메소드

Add a partial packet to the end of the cache by reference.
public AddPartialPacket ( int packetBytes, byte partialPacket ) : void
packetBytes int The number of valid bytes in the provided partial packet
partialPacket byte A buffer which may or may not be full with valid bytes
리턴 void

ClearNTopBytes() 공개 메소드

Clear N bytes from cache, starting with oldest bytes first.
public ClearNTopBytes ( int numBytesToRemove ) : void
numBytesToRemove int The total number of bytes to be removed.
리턴 void

FirstByte() 공개 메소드

Returns the value of the first cached byte.
public FirstByte ( ) : byte
리턴 byte

GetAllData() 공개 메소드

Copies all cached bytes into a single array and returns. Original data is left unchanged.
public GetAllData ( ) : byte[]
리턴 byte[]

NumUnusedBytesMostRecentPartialPacket() 공개 메소드

Returns the number of unused bytes in the most recently cached partial packet.
public NumUnusedBytesMostRecentPartialPacket ( ) : int
리턴 int

PacketBuilder() 공개 메소드

Create a new instance of the ConnectionPacketBuilder class
public PacketBuilder ( ) : System
리턴 System

ReadDataSection() 공개 메소드

Copies the requested cached bytes into a single array and returns. Original data is left unchanged.
public ReadDataSection ( int startIndex, int length ) : MemoryStream
startIndex int The inclusive byte index to use as the starting position.
length int The total number of desired bytes.
리턴 System.IO.MemoryStream

RemoveMostRecentPartialPacket() 공개 메소드

Returns the most recently cached partial packet and removes it from the cache. Used to more efficiently utilise allocated memory space.
public RemoveMostRecentPartialPacket ( int &lastPacketBytesRead ) : byte[]
lastPacketBytesRead int The number of valid bytes in the last partial packet added
리턴 byte[]