/// <summary> /// Initializes a new instance of the <see cref="TcpManager"/> class. /// </summary> public static void InitializeTcp() { if (tcpClient != null) { if (tcpClient.Socket.Connected) { tcpClient.Close(); } tcpClient.DataReceived -= new EventHandler <Tcp.DataReceivedEventArgs>(tcpClient_DataReceived); } tcpClient = new Tcp.TcpClient(); tcpClient.CustomHeaderSize = GetCustomPacketHeaderSize(); tcpClient.DataReceived += new EventHandler <Tcp.DataReceivedEventArgs>(tcpClient_DataReceived); //packetSecurity.SetKey("abcdefgh76876bfgjhgfy8u7iy"); }
public Client(TcpClientIdentifier tcpID, Tcp.TcpClient tcpClient) { this.tcpID = tcpID; this.tcpClient = tcpClient; this.tcpClient.CustomHeaderSize = GetCustomPacketHeaderSize(); this.packetModifiers = new PacketModifiers(); //database = new MySql("localhost", 3306, "test", "root", "test"); #if EVENTTHREAD eventThread = new PlayerEventThread(this); #endif AddEventHandlers(); SetupPacketSecurity(); }
/// <summary> /// Initializes a new instance of the <see cref="TcpManager"/> class. /// </summary> public static void InitializeTcp() { if (tcpClient != null) { if (tcpClient.Socket.Connected) { tcpClient.Close(); } tcpClient.DataReceived -= new EventHandler<Tcp.DataReceivedEventArgs>(tcpClient_DataReceived); } tcpClient = new Tcp.TcpClient(); tcpClient.CustomHeaderSize = GetCustomPacketHeaderSize(); tcpClient.DataReceived += new EventHandler<Tcp.DataReceivedEventArgs>(tcpClient_DataReceived); //packetSecurity.SetKey("abcdefgh76876bfgjhgfy8u7iy"); }