Esempio n. 1
0
        private void btnConnect_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                clientSocket.Connect(textIP.Text, 8888);
                serverStream = clientSocket.GetStream();

                DisplayData = "Server Connected!";
                msg();

                byte[] outStream = System.Text.Encoding.ASCII.GetBytes(textName.Text + "$");
                serverStream.Write(outStream, 0, outStream.Length);
                serverStream.Flush();

                Thread ctThread = new Thread(getMessage);
                ctThread.Start();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                Close();
            }

            cPage = new ClientPage(this);
            cPage.textDisplay.AppendText("Trying to Reach Server at " + this.textIP.Text + " ...");
            this.Content = cPage.Content;
            cPage.ini();
            cPage.Close();
        }
        private void btnConnect_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                clientSocket.Connect(textIP.Text, 8888);
                serverStream = clientSocket.GetStream();

                DisplayData = "Server Connected!";
                msg();

                byte[] outStream = System.Text.Encoding.ASCII.GetBytes(textName.Text + "$");
                serverStream.Write(outStream, 0, outStream.Length);
                serverStream.Flush();

                Thread ctThread = new Thread(getMessage);
                ctThread.Start();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                Close();
            }

            cPage = new ClientPage(this);
            cPage.textDisplay.AppendText("Trying to Reach Server at " + this.textIP.Text + " ...");
            this.Content = cPage.Content;
            cPage.ini();
            cPage.Close();
        }