Esempio n. 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");
                }
            }
        }
Esempio n. 2
0
File: Form1.cs Progetto: canoxa/Chat
        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");
                }
            }
        }