Пример #1
0
        //HANDLER DO FORM
        public bool Register(string nick, string port)
        {
            this.nick = nick;

            TcpChannel channel = new TcpChannel(Int32.Parse(port));
            ChannelServices.RegisterChannel(channel, true);

            ObjClient objClient = new ObjClient(formClient);
            RemotingServices.Marshal(objClient,
                "IChatClient",
                typeof(ObjClient));

            string serverUrl = "tcp://localhost:8086/IChatServer";

            serverObj = (ObjServer)Activator.GetObject(
                typeof(ObjServer), serverUrl);

            if (serverObj == null) {
                System.Console.WriteLine("Could not locate server");
                return false;
            }

            string clientUrl = "tcp://localhost:" + port + "/IChatClient";
            serverObj.Register(nick, clientUrl);

            return true;
        }
Пример #2
0
        //HANDLER DO FORM
        public bool Register(string nick, string port)
        {
            this.nick = nick;

            TcpChannel channel = new TcpChannel(Int32.Parse(port));

            ChannelServices.RegisterChannel(channel, true);

            ObjClient objClient = new ObjClient(formClient);

            RemotingServices.Marshal(objClient,
                                     "IChatClient",
                                     typeof(ObjClient));

            string serverUrl = "tcp://localhost:8086/IChatServer";

            serverObj = (ObjServer)Activator.GetObject(
                typeof(ObjServer), serverUrl);

            if (serverObj == null)
            {
                System.Console.WriteLine("Could not locate server");
                return(false);
            }

            string clientUrl = "tcp://localhost:" + port + "/IChatClient";

            serverObj.Register(nick, clientUrl);

            return(true);
        }