public void DetectServer() { tcptochooseServer = new TCPModel(IP, port); tcptochooseServer.ConnectToServer(); string Port = tcptochooseServer.ReadData(); port = int.Parse(Port); }
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(); } } }
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(); } } }