예제 #1
0
 public virtual void func3(RPCParameters rpcParams)
 {
     if(0 < rpcParams.numberOfBitsOfData)
         Console.Write("Base Apple func3: {0}\n", GetString(rpcParams.input));
     else
         Console.Write("Base Apple func3\n");
 }
예제 #2
0
 public static void Route(RPCParameters _params)
 {
     IProcessorRegistry registry = LightweightContainer.Resolve<IProcessorRegistry>();
     // TODO - If client send illegal protocol name then server crushed.
     IProtocolProcessor processor = registry.GetProcessor(_params.recipient, _params.functionName);
     processor.ProcessReceiveParams(_params);
 }
 public void ProcessReceiveParams(RPCParameters _params)
 {
     BitStream source = new BitStream(_params, false);
     try
     {
         IEvent e = factory.RecreateSimpleEvent(source);
         e.Sender = _params.sender;
         dOManager.PostEvent(e);
     }
     catch (NetworkException)  // TODO: Call accurate callback.
     {
         logger.Warn("Ran off end of packet.");
         if (Callbacks != null)
         {
             Callbacks.OnRanOffEndOfBitstream(_params.sender);  // TODO: This is ad-hoc.
         }
     }
 }
예제 #4
0
        public static void clientRPC(RPCParameters rpcParameters)
        {
            BitStream b = new BitStream(rpcParameters, false);
            string name;

            if (!b.Read(out name))
            {
                Console.Write("Too-short bitstreams.\n");
                return;
            }

            Console.Write("In clientRPC:\n");
            Console.Write("Name is {0}\n", name);

            uint age;
            if (!b.ReadCompressed(out age))
            {
                return;
            }

            Console.Write("Age is {0}\n", age);
            Console.Out.Flush();

            bool wroteEmploymentStruct;
            if (!b.Read(out wroteEmploymentStruct))
            {
                return;
            }

            if (wroteEmploymentStruct)
            {
                Console.Write("We are employed.\n");

                EmploymentStruct employmentStruct;
                if (!b.Read(out employmentStruct.salary)) return;
                if (!b.Read(out employmentStruct.yearsEmployed)) return;

                Console.Write("Salary is {0}.  Years employed is {1}\n", employmentStruct.salary, employmentStruct.yearsEmployed);
            }
            else
                Console.Write("We are between jobs :)\n");

            quit = true;
        }
예제 #5
0
 public override void func1(RPCParameters rpcParams)
 {
     Console.Write("Derived GrannySmith func1: {0}\n", GetString(rpcParams.input));
 }