Esempio n. 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");
        }
Esempio n. 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();
        }
Esempio n. 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();
        }
Esempio n. 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");
        }