我正在使用C#& amp;创建一个远程桌面应用程序。 NodeJS,C#应用程序将图像流发送到NodeJS webapp,将其发送到另一个客户端,在我的机器上一切正常,但是当我托管应用程序时,滞后是不可能的,我的方法如下:
这是主要代码:
ms = new MemoryStream();
Bitmap bmp = ImageManager.CaptureScreen(true);
if(temp != null && count < 21)
{
Bitmap diff = ImageManager.GetDiffBitmap(temp, bmp); //Calculate the difference between the previous (if not null) and the current screenshot
diff.Save(ms, ImageFormat.Png);
}
else
{
richTextBox1.Text = "Reset";
count = 0;
bmp.Save(ms, ImageFormat.Gif);//Save the image as GIF to reduce size
temp = bmp;
}
buffer = ms.ToArray();
richTextBox1.Text += "Sent: [" + buffer.Length + "] bytes.\n";
socket.Emit("image" + (count == 0 ? " init" : ""), buffer); //Send the image
count++;
在服务器端:
socket.on("image init", (bin) => {
io.emit("image+", bin);
});
socket.on("image", (bin) => {
io.emit("image up", bin);
});
改善用户体验并使应用更合适的想法? 提前致谢