예제 #1
0
파일: Packer.cs 프로젝트: slawer/service
        // ------- Конструктор --------------
        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);
        }
예제 #2
0
파일: Main.cs 프로젝트: slawer/service
        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;
        }