GetData() public method

Gets the data in this packet, excluding the header.
public GetData ( ) : byte[]
return byte[]
Example #1
0
 /// <summary>
 /// Decodes a packet to a string.
 /// </summary>
 /// <param name="p">The packet to decode.</param>
 /// <returns>The string containing the information that was contained in the packet. </returns>
 public static String DecodePacketString(Packet p, int index)
 {
     String result = "";
     byte[] data = p.GetData();
     for( int i = index; i < data.Length; i++){
         result += ((char)data[i]) + "";
     }
     return result;
 }
Example #2
0
 /// <summary>
 /// Decodes a packet that should contain an int.
 /// </summary>
 /// <param name="p">The packet</param>
 /// <param name="index">The byte index to start searching for the int</param>
 /// <returns>The integer</returns>
 public static int DecodePacketInt(Packet p, int index)
 {
     return BitConverter.ToInt32(p.GetData(), index);
 }