static void Main(string[] args) { TcpChannel chnl = new TcpChannel(); ChannelServices.RegisterChannel(chnl, false); //Pile pile = (Pile)Activator.GetObject(typeof(Pile), "tcp://localhost:1111/Pile"); UsinePile usinePile = (UsinePile)Activator.GetObject(typeof(UsinePile), "tcp://localhost:1111/UsinePile"); Console.WriteLine("Client 1"); Console.WriteLine("donnez la taille de la pile a creer : "); Pile pile = usinePile.creationPile(int.Parse(Console.ReadLine())); for (int i = 0; i < 3; i++) { Console.WriteLine("Etudiant" + i + 1); String nom = Console.ReadLine(); String prenom = Console.ReadLine(); int id = int.Parse(Console.ReadLine()); pile.empiler(new Etudiant(id, nom, prenom)); } //pile.empiler(new Etudiant(11,"houssein","hhoo")); Console.WriteLine("taille courante : " + pile.lire_taille_courante()); Console.WriteLine("taille max : " + pile.lire_taille_max()); }
private void connect_Click(object sender, EventArgs e) { try { TcpChannel chl = new TcpChannel(); ChannelServices.RegisterChannel(chl, false); Console.WriteLine("Client: Canal enregistré"); usine = (UsinePile)Activator.GetObject(typeof(UsinePile), "tcp://" + ip.Text + ":1234/usinePile"); MessageBox.Show("connection effectué avec succes a l'usine"); ip.Enabled = false; } catch (Exception ex) { MessageBox.Show("ERREUR :" + ex.Message); Console.WriteLine("ERREUR :" + ex.Message); } }