示例#1
0
 private void CheckClientToServerQueue()
 {
     while (true)
     {
         Thread.Sleep(50);
         if (ServerTalk.HasCommands() == true)
         {
             ServerTalk.SendToClient();
         }
     }
 }
示例#2
0
        public Client(int port)
        {
            // creates a client object that 'lives' here on the client.
            _CallbackSink = new CallbackSink();

            // hook into the event exposed on the Sink object so we can transfer a server
            // message through to this class.
            _CallbackSink.OnHostToClient += new delCommsInfo(CallbackSink_OnHostToClient);

            // Register a client channel so the server can communicate back - it needs a channel
            // opened for the callback to the CallbackSink object that is anchored on the client!
            TcpChannel channel = new TcpChannel(port);

            ChannelServices.RegisterChannel(channel, true);


            // now create a transparent proxy to the server component
            _ServerTalk = (ServerTalk)Activator.GetObject(typeof(ServerTalk), "tcp://localhost:9000/MyRemoteObject");
        }