コード例 #1
0
        public void DetectServer()
        {
            tcptochooseServer = new TCPModel(IP, port);
            tcptochooseServer.ConnectToServer();
            string Port = tcptochooseServer.ReadData();

            port = int.Parse(Port);
        }
コード例 #2
0
 public void ListenOpponent()
 {
     while (true)
     {
         string result = tcpforOpponent.ReadData();
         Thread th     = new Thread(mamquay);
         th.Start(result);
         th.Join();
         txtPointOfOpponent.Text = kq;
         if (txtPointOfOpponent.Text != "" && txtPointOfPlayer.Text != "")
         {
             UpdatePrize();
         }
     }
 }
コード例 #3
0
 private void btnPlay_Click(object sender, EventArgs e)
 {
     if (txtMoney.Text != "")
     {
         btnPlay.Enabled = false;
         btnNext.Enabled = true;
         int error = tcpforplayer.SendData("tung");
         if (error == -1)
         {
             port = 8080; // port root server
             Connect();
         }
         string result = tcpforplayer.ReadData();
         Thread th     = new Thread(mamquay);
         th.Start(result);
         th.Join();
         txtPointOfPlayer.Text = kq;
         if (txtPointOfOpponent.Text != "" && txtPointOfPlayer.Text != "")
         {
             UpdatePrize();
         }
     }
 }