Class NetworkStream
Objects and values serialization stream for sending data over network. Uses memory buffer for both read and write operations.
Inherited Members
Assembly: FlaxEngine.dll
File: Engine/Networking/NetworkStream.h
Syntax
public class NetworkStream : public ScriptingObject, public ReadStream, public WriteStream
Constructors
~NetworkStream()
Declaration
public ~NetworkStream()
Fields
SenderId
The ClientId of the network client that is a data sender. Can be used to detect who send the incoming RPC or replication data. Set to the current client when writing data.
Declaration
public uint32 SenderId = 0
Field Value
uint32
|
Methods
Close()
Flush()
GetBuffer()
Gets the pointer to the native stream memory buffer.
Declaration
public byte* GetBuffer() const
Returns
byte
|
GetLength()
Gets length of the stream
Declaration
public virtual uint32 GetLength() override
Returns
uint32
Length of the stream |
Overrides
GetPosition()
Gets current position in the stream
Declaration
public virtual uint32 GetPosition() override
Returns
uint32
Current position in the stream |
Overrides
Initialize(byte* buffer, uint32 length)
Initializes the stream for reading.
Declaration
public void Initialize(byte* buffer, uint32 length)
Parameters
byte
buffer
The allocated memory. |
uint32
length
The allocated memory length (bytes count). |
Initialize(uint32 minCapacity=1024)
Initializes the stream for writing. Allocates the memory or reuses already existing memory. Resets the current stream position to beginning.
Declaration
public void Initialize(uint32 minCapacity=1024)
Parameters
uint32
minCapacity
The minimum capacity (in bytes) for the memory buffer used for data storage. |
Read(INetworkSerializable& obj)
Read(INetworkSerializable* obj)
Read(Quaternion& data)
Read(Transform& data, bool useDouble=false)
Declaration
public void Read(Transform& data, bool useDouble=false)
Parameters
Transform
data
|
bool
useDouble
|
ReadBytes(void* data, uint32 bytes)
Reads bytes from the stream
Declaration
public virtual void ReadBytes(void* data, uint32 bytes) override
Parameters
void
data
Data to read |
uint32
bytes
Amount of bytes to read |
Overrides
ReadData(void* data, int32 bytes)
Reads bytes from the stream
Declaration
public void ReadData(void* data, int32 bytes)
Parameters
void
data
Data to write |
int32
bytes
Amount of bytes to write |
Returns
void
|
SetPosition(uint32 seek)
Set new position in the stream
Declaration
public virtual void SetPosition(uint32 seek) override
Parameters
uint32
seek
New position in the stream |
Overrides
Write(const Quaternion& data)
Write(const Transform& data, bool useDouble=false)
Declaration
public void Write(const Transform& data, bool useDouble=false)
Parameters
Transform
data
|
bool
useDouble
|
Write(INetworkSerializable& obj)
Write(INetworkSerializable* obj)
WriteBytes(const void* data, uint32 bytes)
Writes bytes to the stream.
Declaration
public virtual void WriteBytes(const void* data, uint32 bytes) override
Parameters
void
data
Pointer to data to write. |
uint32
bytes
Amount of bytes to write. |
Overrides
WriteData(const void* data, int32 bytes)
Writes bytes to the stream
Declaration
public void WriteData(const void* data, int32 bytes)
Parameters
void
data
Data to write |
int32
bytes
Amount of bytes to write |
Returns
void
|