예제 #1
0
파일: Program.cs 프로젝트: cpm2710/cellbank
        static void Main(string[] args)
        {
            //DesktopUtil.Instance.GetChangedImages();
            WebDesktopTCPServer server = new WebDesktopTCPServer();
            server.Listen();
            long now = System.DateTime.Now.Ticks / 10000;
            while (true)
            {
                now = System.DateTime.Now.Ticks / 10000;
                WebDesktopTCPClient CLIENT = new WebDesktopTCPClient("andy-PC", 3390, 3391);
                string base64String = CLIENT.GetSliceImages();

                MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(base64String));
                DataContractJsonSerializer ser =
                  new DataContractJsonSerializer(typeof(DesktopSnapshotList));
                DesktopSnapshotList ss = ser.ReadObject(ms) as DesktopSnapshotList;
               // Console.WriteLine((System.DateTime.Now.Ticks / 10000 - now) + "ms");
                for (int i = 0; i < ss.Count; i++)
                {
                   // Console.WriteLine(ss[i].Width + "  and " + ss[i].Height);
                }
               // Console.WriteLine(ss.Count);

                Thread.Sleep(2000);
            }
        }
예제 #2
0
 public DesktopSnapshot sendControlCommand(ControlCommand ControlCommand)
 {
     WebDesktopTCPClient client = new WebDesktopTCPClient(ControlCommand.MachineName);
     string base64=client.SendControl(ControlCommand);
     DesktopSnapshot snapshot = new DesktopSnapshot();
     snapshot.DesktopBase64 = base64;
     return snapshot;
 }
예제 #3
0
 public DesktopSnapshot getDesktopSnapshot(string MachineName)
 {
     WebDesktopTCPClient client = new WebDesktopTCPClient(MachineName);
     string base64 = client.GetImage();
     DesktopSnapshot snapshot = new DesktopSnapshot();
     snapshot.DesktopBase64 = base64;
     return snapshot;
     //DesktopSnapshot snapshot=new DesktopSnapshot();
     //snapshot.MachineName = MachineName;
     //Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
     //socket.Connect(MachineName, 3390);
     //NetworkStream ns = new NetworkStream(socket);
     //StreamReader sr = new StreamReader(ns);
     //string base64=sr.ReadToEnd();
     //socket.Shutdown(SocketShutdown.Both);
     //socket.Close();
     ////IPHostEntry hostinfo = Dns.GetHostEntry(MachineName);
     //snapshot.DesktopBase64 = base64;
     ////serverIP = IPAddress.Parse("222.18.142.171");
     //return snapshot;
 }
예제 #4
0
 public string getDesktopSnapshots(string MachineName)
 {
     WebDesktopTCPClient client = new WebDesktopTCPClient(MachineName);
     return client.GetSliceImages();
 }