public void LoopClients() { while (_isRunning) { TcpClient newClient = Server.AcceptTcpClient(); Thread t = new Thread(new ParameterizedThreadStart(HandleClient)); t.Start(newClient); } } public void HandleClient(object obj) { TcpClient client = (TcpClient)obj; BinaryFormatter binaryformatter = new BinaryFormatter(); while (client.Connected) { MainStream = client.GetStream(); binaryformatter.Serialize(MainStream, GrabDesktop()); } } private static Image GrabDesktop() { System.Drawing.Rectangle bound = Screen.PrimaryScreen.Bounds; Bitmap screenshot = new Bitmap(bound.Width, bound.Height, PixelFormat.Format32bppArgb); Graphics graphics = Graphics.FromImage(screenshot); graphics.CopyFromScreen(bound.X, bound.Y, 0, 0, bound.Size, CopyPixelOperation.SourceCopy); return screenshot; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)