Example #1
0
        public static void Main(string[] args)
        {
            int port = 9001;
            var server = new VMAgentServer(port);

            server.InstallHandler("GetFile", GetFileHandler);
            server.InstallHandler("PutFile", PutFileHandler);
            server.InstallHandler("GetFileList", GetFileListHandler);
            server.InstallHandler ("StartProgram", StartProgramHandler);
            server.InstallHandler("GetProgramResult", GetProgramResultHandler);

            new Thread(server.Run).Start ();
            /*
            var remoteAgent = new RemoteVMAgent("localhost", port);

            Console.WriteLine (remoteAgent.GetFileList("/").Aggregate(" ", (acc, e) => acc + e + "\n"));

            //var strm = new MemoryStream();
            //remoteAgent.GetFile ("/initrd.img", strm);
            //Console.WriteLine("Position: " + strm.Position);
            //strm.Seek (0, SeekOrigin.Begin);

            using(FileStream fs = File.OpenRead("/initrd.img"))
            {
                remoteAgent.PutFile(fs, "/home/lee/lol.img");
            }

            //remoteAgent.GetFile("/initrd.img", ); */
        }
Example #2
0
        public static void Main(string[] args)
        {
            int port   = 9001;
            var server = new VMAgentServer(port);

            server.InstallHandler("GetFile", GetFileHandler);
            server.InstallHandler("PutFile", PutFileHandler);
            server.InstallHandler("GetFileList", GetFileListHandler);
            server.InstallHandler("StartProgram", StartProgramHandler);
            server.InstallHandler("GetProgramResult", GetProgramResultHandler);

            new Thread(server.Run).Start();

            /*
             * var remoteAgent = new RemoteVMAgent("localhost", port);
             *
             * Console.WriteLine (remoteAgent.GetFileList("/").Aggregate(" ", (acc, e) => acc + e + "\n"));
             *
             * //var strm = new MemoryStream();
             * //remoteAgent.GetFile ("/initrd.img", strm);
             * //Console.WriteLine("Position: " + strm.Position);
             * //strm.Seek (0, SeekOrigin.Begin);
             *
             * using(FileStream fs = File.OpenRead("/initrd.img"))
             * {
             *      remoteAgent.PutFile(fs, "/home/lee/lol.img");
             * }
             *
             * //remoteAgent.GetFile("/initrd.img", ); */
        }