Post

PipeMessage

Structure containing the contents of a message passed between server and clients.


Remarks

A basic structure for packaging messages that are passed through a pipe stream. Data should be packaged into a byte[] array, presumably by a serialize function. Each PipeMessage contains a single character message code (MsgCode), used to indicate the type of content in the byte[] array. Only a char value of ‘0’ is reserved for encoding and decoding strings. Developers can use the other 254 characters for their own purposes.


Constructors

SyntaxDescription
PipeMessageDefault constructor.

Properties

IdentifierTypeDescription
MsgCodecharA single character to indicate the type of message.
MsgDatabyte[]The contents of the message encoded to a byte array.

Methods

MethodReturnsDescription
DecodeString()stringDecoder method to convert the byte[] MsgData array to a string. Should only be called if the array originated from a string.
EncodeString(string str)voidEncoder method to convert any string into the byte[] MsgData. Note that the MsgCode is automatically set to ‘0’, which is reserved for string data.

Example

None yet.

This post is licensed under CC BY 4.0 by the author.

Trending Tags