C# Class NetworkCommsDotNet.PacketHeader

Contains information required to send, receive and correctly rebuild any objects sent via NetworkComms.Net. Any data sent via NetworkCommsDotNet is always preceded by a packetHeader.
Inheritance: IExplicitlySerialize
Afficher le fichier Open project: MarcFletcher/NetworkComms.Net Class Usage Examples

Méthodes publiques

Méthode Description
ContainsOption ( PacketHeaderLongItems option ) : bool

Check if a long option has been set.

ContainsOption ( PacketHeaderStringItems option ) : bool

Check if a string option has been set.

Deserialize ( Stream inputStream ) : void
Deserialize ( Stream inputStream, PacketHeader &result ) : void

Deserializes from a memory stream to a PacketHeader object

GetOption ( PacketHeaderLongItems option ) : long

Get a long option.

GetOption ( PacketHeaderStringItems options ) : string

Get a string option

PacketHeader ( string packetTypeStr, long payloadPacketSize, SendReceiveOptions sendReceiveOptions = null, string requestedReturnPacketTypeStr = null, string checkSumHash = null ) : System

Creates a new packetHeader

Serialize ( Stream outputStream ) : void
SetOption ( PacketHeaderLongItems option, long Value ) : void

Set a long option with the provided value.

SetOption ( PacketHeaderStringItems option, string Value ) : void

Set a string option with the provided value.

Private Methods

Méthode Description
PacketHeader ( ) : System
PacketHeader ( MemoryStream packetHeaderStream, SendReceiveOptions headerSendReceiveOptions ) : System

Constructor used for deserialisation

Method Details

ContainsOption() public méthode

Check if a long option has been set.
public ContainsOption ( PacketHeaderLongItems option ) : bool
option PacketHeaderLongItems The long option to be checked.
Résultat bool

ContainsOption() public méthode

Check if a string option has been set.
public ContainsOption ( PacketHeaderStringItems option ) : bool
option PacketHeaderStringItems The string option to be checked.
Résultat bool

Deserialize() public méthode

public Deserialize ( Stream inputStream ) : void
inputStream Stream
Résultat void

Deserialize() public static méthode

Deserializes from a memory stream to a PacketHeader object
public static Deserialize ( Stream inputStream, PacketHeader &result ) : void
inputStream Stream The memory stream containing the serialized
result PacketHeader The deserialized
Résultat void

GetOption() public méthode

Get a long option.
public GetOption ( PacketHeaderLongItems option ) : long
option PacketHeaderLongItems The option to get
Résultat long

GetOption() public méthode

Get a string option
public GetOption ( PacketHeaderStringItems options ) : string
options PacketHeaderStringItems The option to get
Résultat string

PacketHeader() public méthode

Creates a new packetHeader
public PacketHeader ( string packetTypeStr, long payloadPacketSize, SendReceiveOptions sendReceiveOptions = null, string requestedReturnPacketTypeStr = null, string checkSumHash = null ) : System
packetTypeStr string The packet type to be used.
payloadPacketSize long The size on bytes of the payload
sendReceiveOptions SendReceiveOptions Send receive options which may contain header relevant options.
requestedReturnPacketTypeStr string An optional field representing the expected return packet type
checkSumHash string An optional field representing the payload checksum
Résultat System

Serialize() public méthode

public Serialize ( Stream outputStream ) : void
outputStream Stream
Résultat void

SetOption() public méthode

Set a long option with the provided value.
public SetOption ( PacketHeaderLongItems option, long Value ) : void
option PacketHeaderLongItems The option to set
Value long The option value
Résultat void

SetOption() public méthode

Set a string option with the provided value.
public SetOption ( PacketHeaderStringItems option, string Value ) : void
option PacketHeaderStringItems The option to set
Value string The option value
Résultat void