Ejemplo n.º 1
0
        public Client(TransportLayer tl)
        {
            this.tl = tl;

            //Channels
            this.inChannels       = Hashtable.Synchronized(new Hashtable());
            this.outChannels      = Hashtable.Synchronized(new Hashtable());
            this.channelsToRemove = new List <Channel>();
            this.lockChannels     = new object();
            this.eventChannelOutputNeedsToBeProcessed = new AutoResetEvent(true);

            this.control_channel = new Channel(Channel.Encodings.BYTEARRAY, Channel.Types.BIDIRECTIONAL, this.callbackChannelOutputPresent, null); //Caution, this has to be the first channel to be created, in order to assure channel ID is 0
            this.AddChannel(control_channel);


            //Processes
            this.pending_client_processes   = Hashtable.Synchronized(new Hashtable());
            this.pendingClientProcessesLock = new object();
            this.exitedProcesses            = new List <ClientProcess>();
            this.exitedProcessesLock        = new object();

            //RPC methods
            this.pending_method_calls   = Hashtable.Synchronized(new Hashtable());
            this.pendingMethodCallsLock = new object();

            //Stream objects
            this.opened_streams    = Hashtable.Synchronized(new Hashtable());
            this.openedStreamsLock = new object();

            this.running = true;
            this.eventDataNeedsToBeProcessed = new AutoResetEvent(true);

            this.tl.registerTimeoutCallback(this.linklayerTimeoutHandler);
        }
Ejemplo n.º 2
0
        public static void run(FileStream HIDin, FileStream HIDout)
        {
            LinkLayer ll = new LinkLayer(HIDin, HIDout);

            ll.connect();
            ll.start();

            TransportLayer tl = new TransportLayer(ll);

            Client client = new Client(tl);

            client.SendControlMessage(Client.CTRL_MSG_FROM_CLIENT_STAGE2_RUNNING); // enqueue STAGE2_RUNNING message
            client.run();
        }