Class NetworkMessage
Network message structure. Provides raw data writing and reading to the message buffer.
Inheritance
Namespace: FlaxEngine.Networking
Assembly: FlaxEngine.CSharp.dll
Syntax
[Unmanaged]
public sealed class NetworkMessage : ValueType
Fields
Buffer
The raw message buffer.
Declaration
public byte *Buffer
Field Value
System.Byte*
|
BufferSize
The size in bytes of the buffer that this message has.
Declaration
public uint BufferSize
Field Value
System.UInt32
|
Length
The length in bytes of this message.
Declaration
public uint Length
Field Value
System.UInt32
|
MessageId
The unique, internal message identifier.
Declaration
public uint MessageId
Field Value
System.UInt32
|
Position
The position in bytes in buffer where the next read/write will occur.
Declaration
public uint Position
Field Value
System.UInt32
|
Properties
Default
The default NetworkMessage.
Declaration
public static NetworkMessage Default { get; }
Property Value
NetworkMessage
|
Methods
ReadBoolean()
Reads and returns data of type System.Boolean from the message.
Declaration
public bool ReadBoolean()
Returns
System.Boolean
|
ReadByte()
Reads and returns data of type System.Byte from the message.
Declaration
public byte ReadByte()
Returns
System.Byte
|
ReadBytes(Byte*, Int32)
Reads raw bytes from the message into the given byte array.
Declaration
public void ReadBytes(byte *buffer, int length)
Parameters
System.Byte*
buffer
The buffer pointer that will be used to store the bytes. Should be of the same length as length or longer. |
System.Int32
length
The minimal amount of bytes that the buffer contains. |
ReadBytes(Byte[], Int32)
Reads raw bytes from the message into the given byte array.
Declaration
public void ReadBytes(byte[] buffer, int length)
Parameters
System.Byte[]
buffer
The buffer that will be used to store the bytes. Should be of the same length as length or longer. |
System.Int32
length
The minimal amount of bytes that the buffer contains. |
ReadDouble()
Reads and returns data of type System.Double from the message.
Declaration
public double ReadDouble()
Returns
System.Double
|
ReadGuid()
Reads and returns data of type System.Guid from the message.
Declaration
public Guid ReadGuid()
Returns
System.Guid
|
ReadInt16()
Reads and returns data of type System.Int16 from the message.
Declaration
public short ReadInt16()
Returns
System.Int16
|
ReadInt32()
Reads and returns data of type System.Int32 from the message.
Declaration
public int ReadInt32()
Returns
System.Int32
|
ReadInt64()
Reads and returns data of type System.Int64 from the message.
Declaration
public long ReadInt64()
Returns
System.Int64
|
ReadQuaternion()
Reads and returns data of type Quaternion from the message.
Declaration
public Quaternion ReadQuaternion()
Returns
Quaternion
|
ReadSByte()
Reads and returns data of type System.SByte from the message.
Declaration
public sbyte ReadSByte()
Returns
System.SByte
|
ReadSingle()
Reads and returns data of type System.Single from the message.
Declaration
public float ReadSingle()
Returns
System.Single
|
ReadString()
Reads and returns data of type System.String from the message. UTF-16 encoded.
Declaration
public string ReadString()
Returns
System.String
|
ReadUInt16()
Reads and returns data of type System.UInt16 from the message.
Declaration
public ushort ReadUInt16()
Returns
System.UInt16
|
ReadUInt32()
Reads and returns data of type System.UInt32 from the message.
Declaration
public uint ReadUInt32()
Returns
System.UInt32
|
ReadUInt64()
Reads and returns data of type System.UInt64 from the message.
Declaration
public ulong ReadUInt64()
Returns
System.UInt64
|
ReadVector2()
Reads and returns data of type Vector2 from the message.
Declaration
public Vector2 ReadVector2()
Returns
Vector2
|
ReadVector3()
Reads and returns data of type Vector3 from the message.
Declaration
public Vector3 ReadVector3()
Returns
Vector3
|
ReadVector4()
Reads and returns data of type Vector4 from the message.
Declaration
public Vector4 ReadVector4()
Returns
Vector4
|
WriteBoolean(Boolean)
Writes data of type System.Boolean into the message.
Declaration
public void WriteBoolean(bool value)
Parameters
System.Boolean
value
|
WriteByte(Byte)
Writes data of type System.Byte into the message.
Declaration
public void WriteByte(byte value)
Parameters
System.Byte
value
|
WriteBytes(Byte*, Int32)
Writes raw bytes into the message.
Declaration
public void WriteBytes(byte *bytes, int length)
Parameters
System.Byte*
bytes
The bytes that will be written. |
System.Int32
length
The amount of bytes to write from the bytes pointer. |
WriteBytes(Byte[], Int32)
Writes raw bytes into the message.
Declaration
public void WriteBytes(byte[] bytes, int length)
Parameters
System.Byte[]
bytes
The bytes that will be written. |
System.Int32
length
The amount of bytes to write from the bytes array. |
WriteDouble(Double)
Writes data of type System.Double into the message.
Declaration
public void WriteDouble(double value)
Parameters
System.Double
value
|
WriteGuid(Guid)
Writes data of type System.Guid into the message.
Declaration
public void WriteGuid(Guid value)
Parameters
System.Guid
value
|
WriteInt16(Int16)
Writes data of type System.Int16 into the message.
Declaration
public void WriteInt16(short value)
Parameters
System.Int16
value
|
WriteInt32(Int32)
Writes data of type System.Int32 into the message.
Declaration
public void WriteInt32(int value)
Parameters
System.Int32
value
|
WriteInt64(Int64)
Writes data of type System.Int64 into the message.
Declaration
public void WriteInt64(long value)
Parameters
System.Int64
value
|
WriteQuaternion(Quaternion)
Writes data of type Quaternion into the message.
Declaration
public void WriteQuaternion(Quaternion value)
Parameters
Quaternion
value
|
WriteSByte(SByte)
Writes data of type System.SByte into the message.
Declaration
public void WriteSByte(sbyte value)
Parameters
System.SByte
value
|
WriteSingle(Single)
Writes data of type System.Single into the message.
Declaration
public void WriteSingle(float value)
Parameters
System.Single
value
|
WriteString(String)
Writes data of type System.String into the message. UTF-16 encoded.
Declaration
public void WriteString(string value)
Parameters
System.String
value
|
WriteUInt16(UInt16)
Writes data of type System.UInt16 into the message.
Declaration
public void WriteUInt16(ushort value)
Parameters
System.UInt16
value
|
WriteUInt32(UInt32)
Writes data of type System.UInt32 into the message.
Declaration
public void WriteUInt32(uint value)
Parameters
System.UInt32
value
|
WriteUInt64(UInt64)
Writes data of type System.UInt64 into the message.
Declaration
public void WriteUInt64(ulong value)
Parameters
System.UInt64
value
|
WriteVector2(Vector2)
Writes data of type Vector2 into the message.
Declaration
public void WriteVector2(Vector2 value)
Parameters
Vector2
value
|
WriteVector3(Vector3)
Writes data of type Vector3 into the message.
Declaration
public void WriteVector3(Vector3 value)
Parameters
Vector3
value
|
WriteVector4(Vector4)
Writes data of type Vector4 into the message.
Declaration
public void WriteVector4(Vector4 value)
Parameters
Vector4
value
|