So you say to do a while loop, to receive all the data in more than one step ?
I have tried that, but i have two problems the one is that i don't know how to properly safe the temp buffer and then join with the other buffer that are received.
Suppouse, i send a data that is read in 5 times by mu buffer.
How could i save the 5 parts (in bytes) and join them propertly ?
And the other thing is, that i don't know when to stop the while loop.
If i send 3mb data, how do i know when all data is received and stop the loop?
public byte receiveDownload()
buffer = new byte;
len = socket.Receive(buffer);
i = (buffer.Length) - 1;
while (buffer[i] == 0)
// now bar[i] is the last non-zero byte
bar = new byte[i + 1];
words = System.Text.Encoding.UTF8.GetString(bar).Split('|');
System.Text.ASCIIEncoding encoding=new System.Text.ASCIIEncoding();
Byte opasgard = encoding.GetBytes("opasgarfinish");
And the file is made, but now with the correct chars, i get:
**You have 敲挀攀椀瘀攀搀 琀栀攀 猀oftware as p牡琀 漀昀 琀栀攀 嘀椀猀ual Studio 9〮 䈀攀琀愀 倀爀漀最爀愀m.
When it must be:
**You have received the software as part of the Visual Studio 9.0 Beta Program.
public class GrossmontBank
//class variables (global - accessible throughout this class)
//scanner object to be used throughout
private static Scanner input = new Scanner(System.in);