//SENDING: public void Send(BasePacket packet) { Console.WriteLine("Sending Packet"); byte[] d = packet.getBytes(); byte[] c = new byte[d.Length + 2]; BitConverter.GetBytes(Convert.ToInt16(d.Length)).CopyTo(c, 0); d.CopyTo(c, 2); try{ this.socket.GetStream().Write(c, 0, c.Length); } catch { this.EmitConnectionLostEvent(); } }
public OnPacketEventArgs(PacketTypes t, BasePacket p) { this._type = t; this._packet = p; }