Class BncsPacket
Completes a DataBuffer implementation with the additional data used by the BNCS protocol.
Inherited Members
Namespace: MBNCSUtil
Assembly: MBNCSUtil.dll
Syntax
public sealed class BncsPacket : DataBuffer
Examples
The following example illustrates creating a buffer that contains only the SID_NULL packet:
Note: this example assumes you have a System.Net.Sockets.Socket object called "sck" in the current context.
[C#]
BncsPacket pckNull = new BncsPacket(0);
sck.Send(pckNull.GetData(), 0, pckNull.Count, SocketFlags.None);
[Visual Basic]
Dim pckNull As New BncsPacket(0)
sck.Send(pckNull.GetData(), 0, pckNull.Count, SocketFlags.None)
[C++]
BncsPacket ^pckNull = gcnew BncsPacket(0);
sck->Send(pckNull->GetData(), 0, pckNull->Count, SocketFlags.None);
The following example illustrates calculating the revision check (SID_AUTH_ACCONTLOGON) of Warcraft III:
Note: this example assumes you have a System.Net.Sockets.Socket object called "sck" in the current context.
[C#]
BncsPacket pckLogin = new BncsPacket(0x53);
NLS nls = new NLS(userName, password);
nls.LoginAccount(pckLogin);
sck.Send(pckLogin.GetData(), 0, pckLogin.Count, SocketFlags.None);
[Visual Basic]
Dim pckLogin As New BncsPacket(&H51)
Dim nls As New NLS(userName, password)
nls.LoginAccount(pckLogin)
sck.Send(pckLogin.GetData(), 0, pckLogin.Count, SocketFlags.None)
[C++]
// NOTE that userName and password must be System::String^, not char*!
BncsPacket ^pckLogin = gcnew BncsPacket(0x51);
NLS ^nls = gcnew NLS(userName, password);
nls->LoginAccount(pckLogin)
sck->Send(pckLogin->GetData(), 0, pckLogin->Count, SocketFlags.None);
Constructors
| Improve this Doc View SourceBncsPacket(Byte)
Creates a new BNCS packet with the specified packet ID.
Declaration
public BncsPacket(byte id)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | id | The BNCS packet ID. |
Properties
| Improve this Doc View SourceCount
Gets the total number of bytes in this packet, including the four-byte header.
Declaration
public override int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Overrides
| Improve this Doc View SourcePacketID
Gets or sets the ID of the packet as it was specified when it was created.
Declaration
public byte PacketID { get; set; }
Property Value
Type | Description |
---|---|
System.Byte |
Methods
| Improve this Doc View SourceGetData()
Gets the data in this packet, including the four-byte header.
Declaration
public override byte[] GetData()
Returns
Type | Description |
---|---|
System.Byte[] | A byte array containing the packet data. |