Пример #1
0
        private void btnConnect_Click(object sender, EventArgs e)
        {
            _client = new ClientSide();

            if (!_client.Connect(new IPEndPoint(IPAddress.Loopback, 33533)))
            {
                return;
            }

            _client.Connected    += _client_Connected;
            _client.Disconnected += _client_Disconnected;

            //Request GUID from server
            _sender = new Sender();
            _client.ClientSend(_sender.RequestGuid());

            //Enable ping timer :)
            tmrPing.Enabled = true;
        }
Пример #2
0
        private void OkButton1_Click(object sender, EventArgs e)
        {
            string ip       = IpTextBox1.Text;
            int    port     = (int)PortUpDown.Value;
            string UserName = NickNametextBox2.Text;
            //send to clientSide?
            ClientSide Client = new ClientSide(ip, port, ClientColor, UserName);
            //       chatting = new Chat(Client, ClientColor, NickNametextBox2.Text);
            bool res = Client.Connect(ip, port);

            Client.sendMessageToServer(UserName);
            if (!res)
            {
                MessageBox.Show("Cant connect to server");
                return;
            }
            //     ConnectedClients f = new ConnectedClients(ClientColor, UserName.Text, client);
            this.Hide();
            chatting.Show();
        }