Exemple #1
0
        private static void ArquiteturaBaseadaEmObjetos()
        {
            string     message = "Entrei na conversa";
            int        id;
            TcpChannel tcpChannel = new TcpChannel();

            ChannelServices.RegisterChannel(tcpChannel, false);

            Type requiredType = typeof(ISend);

            remoteObject = (ISend)Activator.GetObject(requiredType,
                                                      "tcp://localhost:9998/MailServer");

            id = remoteObject.Register();

            new Thread(refreshMessages).Start();

            while (true)
            {
                lock (lockObj)
                {
                    mensagens = remoteObject.SendMessage(id, message);
                    Console.WriteLine(mensagens);
                }

                message = System.Console.ReadLine();
                Console.Clear();
            }
        }