예제 #1
0
        public void RegisterClient(String nickname, int port)
        {
            RegisterClientEventArgs e = new RegisterClientEventArgs(nickname, port);

            if (registerClientHandler != null)
            {
                registerClientHandler(this, e);
            }
        }
예제 #2
0
        public void RegisterClient(Object sender, RegisterClientEventArgs eventArgs)
        {
            KeyValuePair <int, IClientRemoteObject> dummy;

            //throw new RemotingException();
            if (!registry.TryGetValue(eventArgs.nickname, out dummy))
            {
                IClientRemoteObject remoteObject = (IClientRemoteObject)Activator.GetObject(
                    typeof(IServerRemoteObject),
                    "tcp://localhost:" + eventArgs.port + "/Conversation");
                registry.Add(eventArgs.nickname, new KeyValuePair <int, IClientRemoteObject>(eventArgs.port, remoteObject));
                Console.WriteLine("Registered: Nickname -> {0} Port -> {1}", eventArgs.nickname, eventArgs.port);
            }
            else
            {
                throw new RemotingException();
            }
        }