Skip to content

Class Lidgren::Network::NetIncomingMessage

ClassList > Lidgren > Network > NetIncomingMessage

Incoming message either sent from a remote peer or generated within the library.

Inherits the following classes: Lidgren::Network::NetBuffer

Public Properties

Type Name
property NetDeliveryMethod DeliveryMethod
Gets the delivery method this message was sent with (if user data)
property NetIncomingMessageType MessageType
Gets the type of this incoming message.
property double ReceiveTime
What local time the message was received from the network.
property NetConnection SenderConnection
NetConnection of sender, if any.
property NetEndPoint SenderEndPoint
endpoint of sender, if any
property int SequenceChannel
Gets the sequence channel this message was sent with (if user data)

Public Properties inherited from Lidgren::Network::NetBuffer

See Lidgren::Network::NetBuffer

Type Name
property byte[] Data
Gets or sets the internal data buffer.
property int LengthBits
Gets or sets the length of the used portion of the buffer in bits.
property int LengthBytes
Gets or sets the length of the used portion of the buffer in bytes.
property long Position
Gets or sets the read position in the buffer, in bits (not bytes)
property int PositionInBytes
Gets the position in the buffer in bytes; note that the bits of the first returned byte may already have been read - check the Position property to make sure.

Public Functions

Type Name
bool Decrypt (NetEncryption encryption)
Decrypt a message.
double ReadTime (bool highPrecision)
Reads a value, in local time comparable to NetTime.Now, written using WriteTime() Must have a connected sender.
override string ToString ()
Returns a string that represents this object.

Public Functions inherited from Lidgren::Network::NetBuffer

See Lidgren::Network::NetBuffer

Type Name
void EnsureBufferSize (int numberOfBits)
Ensures the buffer can hold this number of bits.
bool PeekBoolean ()
Reads a 1-bit Boolean without advancing the read pointer.
byte PeekByte ()
Reads a Byte without advancing the read pointer.
byte PeekByte (int numberOfBits)
Reads the specified number of bits into a Byte without advancing the read pointer.
byte[] PeekBytes (int numberOfBytes)
Reads the specified number of bytes without advancing the read pointer.
void PeekBytes (byte[] into, int offset, int numberOfBytes)
Reads the specified number of bytes without advancing the read pointer.
byte[] PeekDataBuffer ()
Gets the internal data buffer.
double PeekDouble ()
Reads a 64-bit Double without advancing the read pointer.
float PeekFloat ()
Reads a 32-bit Single without advancing the read pointer.
Int16 PeekInt16 ()
Reads an Int16 without advancing the read pointer.
Int32 PeekInt32 ()
Reads an Int32 without advancing the read pointer.
Int32 PeekInt32 (int numberOfBits)
Reads the specified number of bits into an Int32 without advancing the read pointer.
Int64 PeekInt64 ()
Reads an Int64 without advancing the read pointer.
Int64 PeekInt64 (int numberOfBits)
Reads the specified number of bits into an Int64 without advancing the read pointer.
sbyte PeekSByte ()
Reads an SByte without advancing the read pointer.
float PeekSingle ()
Reads a 32-bit Single without advancing the read pointer.
string PeekString ()
Reads a string without advancing the read pointer.
UInt16 PeekUInt16 ()
Reads a UInt16 without advancing the read pointer.
UInt32 PeekUInt32 ()
Reads a UInt32 without advancing the read pointer.
UInt32 PeekUInt32 (int numberOfBits)
Reads the specified number of bits into a UInt32 without advancing the read pointer.
UInt64 PeekUInt64 ()
Reads a UInt64 without advancing the read pointer.
UInt64 PeekUInt64 (int numberOfBits)
Reads the specified number of bits into an UInt64 without advancing the read pointer.
void ReadAllFields (object target)
Reads all public and private declared instance fields of the object in alphabetical order using reflection.
void ReadAllFields (object target, BindingFlags flags)
Reads all fields with the specified binding of the object in alphabetical order using reflection.
void ReadAllProperties (object target)
Reads all public and private declared instance fields of the object in alphabetical order using reflection.
void ReadAllProperties (object target, BindingFlags flags)
Reads all fields with the specified binding of the object in alphabetical order using reflection.
void ReadBits (byte[] into, int offset, int numberOfBits)
Reads the specified number of bits into a preallocated array.
bool ReadBoolean ()
Reads a boolean value (stored as a single bit) written using Write(bool)
byte ReadByte ()
Reads a byte.
bool ReadByte (out byte result)
Reads a byte and returns true or false for success.
byte ReadByte (int numberOfBits)
Reads 1 to 8 bits into a byte.
byte[] ReadBytes (int numberOfBytes)
Reads the specified number of bytes.
bool ReadBytes (int numberOfBytes, out byte[] result)
Reads the specified number of bytes and returns true for success.
void ReadBytes (byte[] into, int offset, int numberOfBytes)
Reads the specified number of bytes into a preallocated array.
double ReadDouble ()
Reads a 64 bit floating point value written using Write(Double)
float ReadFloat ()
Reads a 32 bit floating point value written using Write(Single)
NetEndPoint ReadIPEndPoint ()
Reads a stored IPv4 endpoint description.
Int16 ReadInt16 ()
Reads a 16 bit signed integer written using Write(Int16)
Int32 ReadInt32 ()
Reads a 32 bit signed integer written using Write(Int32)
bool ReadInt32 (out Int32 result)
Reads a 32 bit signed integer written using Write(Int32)
Int32 ReadInt32 (int numberOfBits)
Reads a signed integer stored in 1 to 32 bits, written using Write(Int32, Int32)
Int64 ReadInt64 ()
Reads a 64 bit signed integer written using Write(Int64)
Int64 ReadInt64 (int numberOfBits)
Reads a signed integer stored in 1 to 64 bits, written using Write(Int64, Int32)
Matrix4x4 ReadMatrix4X4 ()
void ReadPadBits ()
Pads data with enough bits to reach a full byte. Decreases cpu usage for subsequent byte writes.
Plane ReadPlane ()
Quaternion ReadQuaternion ()
int ReadRangedInteger (int min, int max)
Reads a 32 bit integer value written using WriteRangedInteger()
long ReadRangedInteger (long min, long max)
Reads a 64 bit integer value written using WriteRangedInteger() (64 version)
float ReadRangedSingle (float min, float max, int numberOfBits)
Reads a 32 bit floating point value written using WriteRangedSingle()
Ray ReadRay ()
Rect ReadRect ()
Color32 ReadRgbColor ()
Color32 ReadRgbaColor ()
sbyte ReadSByte ()
Reads a signed byte.
float ReadSignedSingle (int numberOfBits)
Reads a 32 bit floating point value written using WriteSignedSingle()
float ReadSingle ()
Reads a 32 bit floating point value written using Write(Single)
bool ReadSingle (out float result)
Reads a 32 bit floating point value written using Write(Single)
string ReadString ()
Reads a string written using Write(string)
bool ReadString (out string result)
Reads a string written using Write(string) and returns true for success.
double ReadTime (NetConnection connection, bool highPrecision)
Reads a value, in local time comparable to NetTime.Now, written using WriteTime() for the connection supplied.
UInt16 ReadUInt16 ()
Reads a 16 bit unsigned integer written using Write(UInt16)
UInt32 ReadUInt32 ()
Reads an 32 bit unsigned integer written using Write(UInt32)
bool ReadUInt32 (out UInt32 result)
Reads an 32 bit unsigned integer written using Write(UInt32) and returns true for success.
UInt32 ReadUInt32 (int numberOfBits)
Reads an unsigned integer stored in 1 to 32 bits, written using Write(UInt32, Int32)
UInt64 ReadUInt64 ()
Reads a 64 bit unsigned integer written using Write(UInt64)
UInt64 ReadUInt64 (int numberOfBits)
Reads an unsigned integer stored in 1 to 64 bits, written using Write(UInt64, Int32)
float ReadUnitSingle (int numberOfBits)
Reads a 32 bit floating point value written using WriteUnitSingle()
int ReadVariableInt32 ()
Reads a variable sized Int32 written using WriteVariableInt32()
Int64 ReadVariableInt64 ()
Reads a variable sized Int64 written using WriteVariableInt64()
uint ReadVariableUInt32 ()
Reads a variable sized UInt32 written using WriteVariableUInt32()
bool ReadVariableUInt32 (out uint result)
Reads a variable sized UInt32 written using WriteVariableUInt32() and returns true for success.
UInt64 ReadVariableUInt64 ()
Reads a variable sized UInt32 written using WriteVariableInt64()
Vector2 ReadVector2 ()
Vector3 ReadVector3 ()
Vector4 ReadVector4 ()
void SkipPadBits ()
Pads data with enough bits to reach a full byte. Decreases cpu usage for subsequent byte writes.
void SkipPadBits (int numberOfBits)
Pads data with the specified number of bits.
void Write (bool value)
Writes a boolean value using 1 bit.
void Write (byte source)
Write a byte.
void Write (sbyte source)
Writes a signed byte.
void Write (byte source, int numberOfBits)
Writes 1 to 8 bits of a byte.
void Write (byte[] source)
Writes all bytes in an array.
void Write (byte[] source, int offsetInBytes, int numberOfBytes)
Writes the specified number of bytes from an array.
void Write (UInt16 source)
Writes an unsigned 16 bit integer.
void Write (UInt16 source, int numberOfBits)
Writes an unsigned integer using 1 to 16 bits.
void Write (Int16 source)
Writes a signed 16 bit integer.
void Write (Int32 source)
Writes a 32 bit signed integer.
void Write (UInt32 source)
Writes a 32 bit unsigned integer.
void Write (UInt32 source, int numberOfBits)
Writes a 32 bit signed integer.
void Write (Int32 source, int numberOfBits)
Writes a signed integer using 1 to 32 bits.
void Write (UInt64 source)
Writes a 64 bit unsigned integer.
void Write (UInt64 source, int numberOfBits)
Writes an unsigned integer using 1 to 64 bits.
void Write (Int64 source)
Writes a 64 bit signed integer.
void Write (Int64 source, int numberOfBits)
Writes a signed integer using 1 to 64 bits.
void Write (float source)
Writes a 32 bit floating point value.
void Write (double source)
Writes a 64 bit floating point value.
void Write (string source)
Write a string.
void Write (IPEndPoint endPoint)
Writes an endpoint description.
void Write (NetBuffer buffer)
Append all the bits of message to this message.
void Write (Vector2 vector)
void Write (Vector3 vector)
void Write (Vector4 vector)
void Write (Quaternion quaternion)
void Write (Ray ray)
void Write (Plane plane)
void Write (Matrix4x4 matrix)
void Write (Rect rect)
void WriteAllFields (object ob)
Writes all public and private declared instance fields of the object in alphabetical order using reflection.
void WriteAllFields (object ob, BindingFlags flags)
Writes all fields with specified binding in alphabetical order using reflection.
void WriteAllProperties (object ob)
Writes all public and private declared instance properties of the object in alphabetical order using reflection.
void WriteAllProperties (object ob, BindingFlags flags)
Writes all properties with specified binding in alphabetical order using reflection.
void WriteAt (Int32 offset, byte source)
Writes a byte at a given offset in the buffer.
void WriteAt (Int32 offset, UInt16 source)
Writes a 16 bit unsigned integer at a given offset in the buffer.
void WriteAt (Int32 offset, Int16 source)
Writes a 16 bit signed integer at a given offset in the buffer.
void WriteAt (Int32 offset, Int32 source)
Writes a 32 bit signed integer at a given offset in the buffer.
void WriteAt (Int32 offset, UInt32 source)
Writes a 32 bit unsigned integer at a given offset in the buffer.
void WriteAt (Int32 offset, UInt64 source)
Writes a 64 bit unsigned integer at a given offset in the buffer.
void WritePadBits ()
Pads data with enough bits to reach a full byte. Decreases cpu usage for subsequent byte writes.
void WritePadBits (int numberOfBits)
Pads data with the specified number of bits.
int WriteRangedInteger (int min, int max, int value)
Writes an integer with the least amount of bits need for the specified range Returns number of bits written.
int WriteRangedInteger (long min, long max, long value)
Writes an integer with the least amount of bits need for the specified range Returns number of bits written.
void WriteRangedSingle (float value, float min, float max, int numberOfBits)
Compress a float within a specified range using a certain number of bits.
void WriteRgbColor (Color32 color)
void WriteRgbaColor (Color32 color)
void WriteSignedSingle (float value, int numberOfBits)
Compress (lossy) a float in the range -1..1 using numberOfBits bits.
void WriteTime (bool highPrecision)
Writes the current local time to a message; readable (and convertable to local time) by the remote host using ReadTime()
void WriteTime (double localTime, bool highPrecision)
Writes a local timestamp to a message; readable (and convertable to local time) by the remote host using ReadTime()
void WriteUnitSingle (float value, int numberOfBits)
Compress (lossy) a float in the range 0..1 using numberOfBits bits.
int WriteVariableInt32 (int value)
Write Base128 encoded variable sized signed integer of up to 32 bits.
int WriteVariableInt64 (Int64 value)
Write Base128 encoded variable sized signed integer of up to 64 bits.
int WriteVariableUInt32 (uint value)
Write Base128 encoded variable sized unsigned integer of up to 32 bits.
int WriteVariableUInt64 (UInt64 value)
Write Base128 encoded variable sized unsigned integer of up to 64 bits.

Protected Static Attributes inherited from Lidgren::Network::NetBuffer

See Lidgren::Network::NetBuffer

Type Name
const int c_overAllocateAmount = = 4
Number of bytes to overallocate for each message to avoid resizing.

Public Properties Documentation

property DeliveryMethod

NetDeliveryMethod Lidgren.Network.NetIncomingMessage.DeliveryMethod;

property MessageType

NetIncomingMessageType Lidgren.Network.NetIncomingMessage.MessageType;

property ReceiveTime

double Lidgren.Network.NetIncomingMessage.ReceiveTime;

property SenderConnection

NetConnection Lidgren.Network.NetIncomingMessage.SenderConnection;

property SenderEndPoint

NetEndPoint Lidgren.Network.NetIncomingMessage.SenderEndPoint;

property SequenceChannel

int Lidgren.Network.NetIncomingMessage.SequenceChannel;

Public Functions Documentation

function Decrypt

Decrypt a message.

inline bool Lidgren::Network::NetIncomingMessage::Decrypt (
    NetEncryption encryption
) 

Parameters:

  • encryption The encryption algorithm used to encrypt the message

Returns:

true on success

function ReadTime

inline double Lidgren::Network::NetIncomingMessage::ReadTime (
    bool highPrecision
) 

function ToString

inline override string Lidgren::Network::NetIncomingMessage::ToString () 

The documentation for this class was generated from the following file api/unity-plugin/Scripts/Networking/Lidgren.Network/NetIncomingMessage.cs