这是我通过TCP发送桌面屏幕的实际客户端代码:
while (true)
{
try
{
Bitmap screeny = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format24bppRgb);
Graphics theShot = Graphics.FromImage(screeny);
theShot.ScaleTransform(.25F, .25F);
theShot.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);
BinaryFormatter bFormat = new BinaryFormatter();
bFormat.Serialize(dskStream,screeny);
}
catch (Exception)
{
dskStream.Close();
dskClient.Close();
break;
}
}
我已经设置了一个功能,可以切换桌面背景以加快传输速度,但它仍然会变慢。有一些方法可以实现远程传输的速度,除了屏幕碎片和只发送什么变化?