Hi all,

I m developing a Client in QT-1.44 on Redhat 6.1 to access my server written in C# on Windows platform. Its an application like VNC where my server sends its client the updates of its screen in form of byte array and client updates its display window to represent the server desktop changes.

My problem is that i m not an expert of Qt-1.44( required by my Org.) and doesnt know how to convert the byte array into an image form that can be displayed on the display window. Also byte array can be a comprssed image data like jpeg, png.

My Server code in C# roughly is as:

MemoryStream ms = null;
System.Text.ASCIIEncoding encoding =
new System.Drawing.Imaging.EncoderParameters eps = null;
System.Drawing.Imaging.ImageCodecInfo ici = null;

ms = new MemoryStream();
eps = new System.Drawing.Imaging.EncoderParameters(1);
eps.Param[0] = new System.Drawing.Imaging.EncoderParameter(System.Dra wing.Imaging.Encoder.Quality,
(long)80);
ici = GetEncoderInfo("image/png");
desktopbitmap.Save(ms, ici, eps);

ms.Flush();
desktopbitmap.Dispose();
byte[] buffer = ms.GetBuffer();
long arrayLength = ms.Length;

//first send client length of the buffer
byte[] length = encoding.GetBytes(Convert.ToString(arrayLength));
socketForClient.Send(length, 0, length.Length,
System.Net.Sockets.SocketFlags.None);

//now send the actual buffer data
socketForClient.Send(buffer , 0, buffer.Length, System.Net.Sockets.SocketFlags.None);

Now my client in QT have to get the length and byte array data and then have to display the image appropriatly.

Thanx for ur +ve responses.

Rahsid Mahmood