Esempio n. 1
0
        // ------- Конструктор --------------
        public Packer(SocketClient Client)
        {
            client = Client;
            client.OnReceive += new ReceiveEventHandler(client_OnReceive);

            input = new StringBuilder();
            output = new StringBuilder();

            timer = new Timer(new TimerCallback(TranslaterFunction), null, Timeout.Infinite, 10);
            mutex = new Mutex(false);
        }
Esempio n. 2
0
        private void connect_Click(object sender, EventArgs e)
        {
            if (state == ConnectState.Disconnected)
            {
                IPHostEntry entry = Dns.GetHostByName(host);
                client = new SocketClient();

                client.Port = port;
                client.Host = entry.AddressList[0].ToString();

                client.OnConnect += new EventHandler(client_OnConnect);
                client.OnDisconnect += new EventHandler(client_OnDisconnect);

                paker = new Packer(client);
                paker.OnPacket += new Packer.PacketEventHandler(paker_OnPacket);

                client.Connect();
            }
            reConnect = true;
        }