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
ファイルを表示 Open project: MarcFletcher/NetworkComms.Net Class Usage Examples

Public Methods

Method 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

Method Description
PacketHeader ( ) : System
PacketHeader ( MemoryStream packetHeaderStream, SendReceiveOptions headerSendReceiveOptions ) : System

Constructor used for deserialisation

Method Details

ContainsOption() public method

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

ContainsOption() public method

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

Deserialize() public method

public Deserialize ( Stream inputStream ) : void
inputStream Stream
return void

Deserialize() public static method

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
return void

GetOption() public method

Get a long option.
public GetOption ( PacketHeaderLongItems option ) : long
option PacketHeaderLongItems The option to get
return long

GetOption() public method

Get a string option
public GetOption ( PacketHeaderStringItems options ) : string
options PacketHeaderStringItems The option to get
return string

PacketHeader() public method

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
return System

Serialize() public method

public Serialize ( Stream outputStream ) : void
outputStream Stream
return void

SetOption() public method

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
return void

SetOption() public method

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
return void