Esempio n. 1
0
        public Object makeProxy(IRuntimeServer runtime, int marshallFlags, int marshallDepth, ArrayList interfaceList)
        {
            Type[] interfaces = new Type[interfaceList.Count];
            for (int i = 0; i < interfaces.Length; i++)
            {
                interfaces[i] = RuntimeServer.typeArg(interfaceList[i]);
            }
            ProxyHandler handler = new ProxyHandler(runtime, marshallFlags, marshallDepth);

            return(Proxy.BuildProxy(new Proxy.InvocationDelegate(handler.invoke), interfaces));
        }
Esempio n. 2
0
 Object processMacroList(ArrayList args)
 {
     if (RuntimeServer.isMessage(":box", args))
     {
         return(Reflector.numericConvert(RuntimeServer.typeArg(args[1]), args[2]));
     }
     else if (RuntimeServer.isMessage(":vector", args))
     {
         return(reflector.createVector(RuntimeServer.typeArg(args[1])
                                       , args.Count - 2
                                       , args.GetRange(2, args.Count)));
     }
     throw new Exception("unsupported macro sequence");
 }
Esempio n. 3
0
        static void Main(string[] args)
        {
            ArrayList threads = new ArrayList();

            for (;;)
            {
                IReferenceManager referenceManager = new ReferenceManager();
                BaseMarshaller    baseMarshaller   = new BaseMarshaller(referenceManager);
                baseMarshaller.registerMarshaller(Type.GetType("System.Object"), new UniversalMarshaller());
                baseMarshaller.registerMarshaller(typeof(System.Data.SqlClient.SqlDataReader), new SqlDataReaderMarshaller());
                IReflector    reflector = new Reflector(baseMarshaller);
                IReader       reader    = new MessageReader(referenceManager, reflector);
                RuntimeServer server    = new RuntimeServer(reader, baseMarshaller, referenceManager, reflector);
                try
                {
                    if (args.Length >= 1)                    //port #s, run on sockets
                    {
                        //fire up a background thread for all sockets except first
                        for (int i = 1; i < args.Length; i++)
                        {
                            RuntimeServer       rs   = server;
                            Int32               port = Int32.Parse(args[i]);
                            RuntimeSocketServer rts  = new RuntimeSocketServer(rs, port);
                            //Do I need to reference these?
                            Thread t = new Thread(new ThreadStart(rts.processMessagesOnSocket));
                            t.Name = String.Format("Background thread {0}", i);
                            t.Start();
                            threads.Add(t);
                            Console.WriteLine("Started background thread on TCP/IP port {0}", port);
                        }
                        //app lives with first socket
                        Thread.CurrentThread.Name = String.Format("Main thread");
                        RuntimeSocketServer mainRts = new RuntimeSocketServer(server, Int32.Parse(args[0]));
                        Console.WriteLine("Started main thread on TCP/IP port {0}", Int32.Parse(args[0]));
                        mainRts.processMessagesOnSocket();
                    }
                    else                     //run on stdio
                    {
                        Console.WriteLine("foil-cli server bound to stdio streams");
                        server.processMessages(Console.In, Console.Out);
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    break;
                }
            }
        }
 static void Main(string[] args)
 {
     ArrayList	threads	=	new ArrayList();
     for(;;)
     {
         IReferenceManager referenceManager	= new ReferenceManager();
         BaseMarshaller baseMarshaller		= new BaseMarshaller(referenceManager);
         baseMarshaller.registerMarshaller(Type.GetType("System.Object"), new UniversalMarshaller());
         baseMarshaller.registerMarshaller(typeof(System.Data.SqlClient.SqlDataReader), new SqlDataReaderMarshaller());
         IReflector	reflector				=	new Reflector(baseMarshaller);
         IReader reader						= new MessageReader(referenceManager,reflector);
         RuntimeServer server				= new RuntimeServer(reader,baseMarshaller,referenceManager,reflector);
         try
         {
             if(args.Length >= 1) //port #s, run on sockets
             {
                 //fire up a background thread for all sockets except first
                 for(int i=1;i<args.Length;i++)
                 {
                     RuntimeServer	rs		= server;
                     Int32			port	= Int32.Parse(args[i]);
                     RuntimeSocketServer	rts	= new RuntimeSocketServer(rs,port);
                     //Do I need to reference these?
                     Thread	t	=	new Thread(new ThreadStart(rts.processMessagesOnSocket));
                     t.Name	=	String.Format("Background thread {0}",i);
                     t.Start();
                     threads.Add(t);
                     Console.WriteLine("Started background thread on TCP/IP port {0}",port);
                 }
                 //app lives with first socket
                 Thread.CurrentThread.Name	=	String.Format("Main thread");
                 RuntimeSocketServer	mainRts	= new RuntimeSocketServer(server,Int32.Parse(args[0]));
                 Console.WriteLine("Started main thread on TCP/IP port {0}",Int32.Parse(args[0]));
                 mainRts.processMessagesOnSocket();
             }
             else //run on stdio
             {
                 Console.WriteLine("foil-cli server bound to stdio streams");
                 server.processMessages(Console.In,Console.Out);
             }
         }
         catch(Exception ex)
         {
             Console.WriteLine(ex.Message);
             break;
         }
     }
 }
 public RuntimeSocketServer(RuntimeServer	rs,Int32 port)
 {
     this.rs		=	rs;
     this.port	=	port;
 }
Esempio n. 6
0
 public RuntimeSocketServer(RuntimeServer rs, Int32 port)
 {
     this.rs   = rs;
     this.port = port;
 }