Exemple #1
0
        private void JoinChat()
        {
            if (portTxt.Text.Length != 0)
            {
                string url = "tcp://localhost:" + portTxt.Text + "/MyRemoteObjectName";
                channel = new TcpChannel();
                try
                {
                    ChannelServices.RegisterChannel(channel, true);
                }
                catch (RemotingException)
                {
                    MessageBox.Show("tcp channel already joined");
                }

                remoteObj = (MyRemoteObject)Activator.GetObject(typeof(MyRemoteObject), url);


                if (!remoteObj.JoinChat("user1"))
                {
                    MessageBox.Show("user already joined");
                }
                else
                {
                    remoteObj.SendMsgToSvr("user1 joined");
                }
            }
        }
Exemple #2
0
        private void JoinChat()
        {
            if (portTxt.Text.Length != 0)
            {
                string url = "tcp://localhost:" + portTxt.Text + "/MyRemoteObjectName";
                channel = new TcpChannel();
                try
                {
                    ChannelServices.RegisterChannel(channel, true);
                }
                catch(RemotingException)
                {
                    MessageBox.Show("tcp channel already joined");
                }

                remoteObj = (MyRemoteObject)Activator.GetObject(typeof(MyRemoteObject), url);

                if (!remoteObj.JoinChat("user1"))
                {
                    MessageBox.Show("user already joined");
                }
                else
                {
                    remoteObj.SendMsgToSvr("user1 joined");
                }
            }
        }