Ejemplo n.º 1
0
        private void event_butconnect(object sender, EventArgs e)
        {
            cli    = new client();
            servvv = new serveur();
            panelreseau.Controls[6].Click -= event_butconnect;
            try{
                cli.connect(panelreseau.Controls[3].Text, Int32.Parse(panelreseau.Controls[5].Text));
                Console.WriteLine("client co");
            }
            catch (Exception ex) {
                srvth = new Thread(new ThreadStart(srv));
                srvth.Start();
                cltth = new Thread(new ThreadStart(clt));
                cltth.Start();
            }
            if (cltth != null)
            {
                while (cltth.ThreadState != ThreadState.Stopped)
                {
                    Application.DoEvents();
                }
            }

            serveur.send("PSD " + panelreseau.Controls[1].Text, cli.sock);
            while (cli.begin != true)
            {
                Application.DoEvents();
            }

            monop = new Monopoly(cli);
            monop.Show();
            monop.Closed += new System.EventHandler(eventClosed);
            Visible       = false;
        }
Ejemplo n.º 2
0
        private void clt()
        {
            object balanceLock = new object();

            lock (balanceLock){
                try{
                    Console.WriteLine("client en cours de co");
                    cli.connect(panelreseau.Controls[3].Text, Int32.Parse(panelreseau.Controls[5].Text));
                }
                catch (Exception es) {
                    Console.WriteLine(es);
                }
            }
        }