my program right now is sending a screen shot from one computer to the other but the result on the receiving side the img looks like:
Bitmap bmpScreenShot = new Bitmap(screenWidth, screenHeight);
Graphics gfx = Graphics.FromImage((Image)bmpScreenShot);
gfx.CopyFromScreen(0, 0, 0, 0, new Size(screenWidth, screenHeight));
bmpScreenShot.Save("pic.jpg", ImageFormat.Jpeg);
MemoryStream ms = new MemoryStream();
bmpScreenShot.Save(ms, ImageFormat.Jpeg);
bmpbyte = ms.ToArray();
bmpScreenShot.Dispose();
ms.Close();
///////////////////////////
Send_Text("" + screenHeight);
textBox3.Text += ("\r\nSending Hight=" + screenHeight);
Send_Text("" + screenWidth);
textBox3.Text += ("\r\nSending Width=" + screenWidth);
System.Threading.Thread.Sleep(200);
Send_Text("" + bmpbyte.Length);
textBox3.Text += ("\r\nSending size of:" + bmpbyte.Length);
textBox3.Text += "\r\nTransmiting the Screenshot";
stm.Write(bmpbyte, 0, bmpbyte.Length);
textBox3.Text += "\r\nSent IMG :)";
the code on top is the client side of it im sending the size of the pic (hight and width and array length) and it transfers properly but the server as i said has trobles getting the full pic
textBox2.Text += "\r\n Getting h";
byte[] buffer = new byte[320];
s.Receive(buffer);
string str = Encoding.UTF8.GetString(buffer, 0, buffer.Length);
Array.Clear(buffer, 0, buffer.Length);
int h = int.Parse(str);
textBox2.Text += "="+h+"\r\n Getting w";
s.Receive(buffer);
str = Encoding.UTF8.GetString(buffer, 0, buffer.Length);
Array.Clear(buffer, 0, buffer.Length);
int w = int.Parse(str);
textBox2.Text += "="+w+"\r\n Getting p";
s.Receive(buffer);
str = Encoding.UTF8.GetString(buffer, 0, buffer.Length);
Array.Clear(buffer, 0, buffer.Length);
int p = int.Parse(str);
textBox2.Text += "=" + p;
byte[] asd = new byte[p];
Bitmap cc = new Bitmap(h, w);
s.Receive(asd);
MemoryStream ms = new MemoryStream(asd);
Image bmp = Image.FromStream(ms);
bmp.Save("End.jpg", ImageFormat.Jpeg);
pictureBox1.Image = bmp;
plz note that alll of the undefined things are defind some where in the code and the text box lines are just for the user interface one more thing im using the localhost \local network and it all tcp