コード例 #1
0
ファイル: pClient.cs プロジェクト: baochuong1901/nt106
 public void SetupForRecv(Mainform appParent)
 {
     try
     {
         AsyncCallback receiveData = new AsyncCallback(appParent.OnRecievedANS);
         m_sock.BeginReceive(buffer, 0, buffer.Length, SocketFlags.None, receiveData, this);
     }
     catch (Exception ex)
     {
        MessageBox.Show("Recieve callback setup failed! {0}", ex.Message);
     }
 }
コード例 #2
0
        /// <summary>
        /// OK Button 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                int iPlayers = int.Parse(textBox1.Text);
                int iQuestions = int.Parse(textBox3.Text);
                int iTimeOutSeconds = int.Parse(textBox2.Text);
                _mainForm = new Mainform(iPlayers,iTimeOutSeconds,iQuestions);
                this.Hide();
                _mainForm._OptionForm = this;
                this.Owner = _mainForm;
                _mainForm.Show();

            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #3
0
ファイル: Server.cs プロジェクト: rexey3s/Arena100Gameshow
        public DauTruongServer(Form gui, int playerCount)
        {
            try
            {
                _listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                _iPlayers = playerCount;
                _PlayerList = new ArrayList(_iPlayers);
                countdownEvent = new CountdownEvent(_PlayerList.Count);
                GUI = gui as Mainform;

                if (useLoopback == false)
                {
                    IPAddress[] addrList = Dns.GetHostEntry(Dns.GetHostName()).AddressList;
                    foreach (IPAddress ip in addrList)
                    {
                        if (ip.AddressFamily == AddressFamily.InterNetwork)
                            _localAddr = ip;
                    }

                }

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #4
0
 public OptionForm(Form form)
 {
     InitializeComponent();
     _mainForm = form as Mainform;
 }