ace/Source/ACE.Server/Network/ClientMessage.cs
fartwhif f0717d4d23 fixing networking bugs (#1104)
* adding @netstats admin command

* trying to figure out the issue

* fixing bug causing AcknowledgeSequence packets to increment the lastReceivedFragmentSequence variable, causing the Sequence to break and never recover for that session
fixing bug causing RequestTransmit packets to be ignored
fixing bug causing the server to crash when a C2S packet is corrupt or malformed
changing the C2S RequestForTransmit packet count to be per request packet instead of per requested sequence
adding Developer commands junk, junk_s2c, junk_c2s, trash_s2c, and trash_c2s to simulate bad connections and manually corrupt packets

* updating changelog.md

* Update changelog.md

fixed incorrect variable name referred to in change log

* Update changelog.md

fix formatting

* adding preprocessor definition NETDIAG and directives to ACE.Common and ACE.Server to help development by preserving troubleshooting tools without interference with the optimal solution

* Apply suggestions from code review

set accessor only needed for NETDIAG functionality
minor change log addition

* reverting some unnecessary source syntax and formatting changes.
removing an unused exception variable

* reverting some unnecessary source syntax and formatting changes

* minor optimization of a duplicate prevention check
2018-11-30 23:58:00 -05:00

27 lines
601 B
C#

using System.IO;
namespace ACE.Server.Network
{
public class ClientMessage
{
public BinaryReader Payload { get; }
public MemoryStream Data { get; }
public uint Opcode { get; }
public ClientMessage(MemoryStream stream)
{
Data = stream;
Payload = new BinaryReader(Data);
Opcode = Payload.ReadUInt32();
}
public ClientMessage(byte[] data)
{
Data = new MemoryStream(data);
Payload = new BinaryReader(Data);
Opcode = Payload.ReadUInt32();
}
}
}