示例#1
0
        /// <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");
        }
示例#2
0
        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();
        }
示例#3
0
        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();
        }
示例#4
0
        /// <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");
        }