Esempio n. 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            IPAddress ip = IPAddress.Parse("192.168.1.103");
               IPEndPoint ipEnd = new IPEndPoint(ip, 15020);
               Socket ClientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

               ClientSocket.Connect(ipEnd);
               if (ClientSocket.Connected)
               {
                   MessageBox.Show("Connexion OK");
                   Commandes c = new Commandes(ClientSocket,1);
                   c.Show();
               }
               else
               {
                   MessageBox.Show("ERREUR");
               }
        }
Esempio n. 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            simulateur();
            for (int i = 0; i < 5000; i++) { }

            IPAddress ip2 = IPAddress.Parse("127.0.0.1");
            IPEndPoint ipEnd2 = new IPEndPoint(ip2, 15020);
            Socket ClientSocket2 = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

            ClientSocket2.Connect(ipEnd2);
            if (ClientSocket2.Connected)
            {
                MessageBox.Show("Connexion au simulateur ok");
                Commandes c = new Commandes(ClientSocket2,0);
                c.Show();

            }
            else
            {
                MessageBox.Show("Erreur, Simulateur non connecté ou erreur de connexion");
            }
        }