hello,
I need to transfer a big byte array across the internet via tcp...(server to client)
I established the connection, but I don't know how to make the transfer of the big byte array.
Bacause the size of the array I need to send all the array in several packets from the server and recieve it back to one big byte array in the client side, HOW do I do that?
a little sample code will help...
Thanks!!!
abdullahPosted Aug 9, 2005, 1:33 AM
Hi.............
Take a look at this code .............
Plz inform me with the results.....
byte[] data = Encoding.ASCII.GetBytes("Welcome to my test server");
client.Send(data);
int dataSize = 0;
while(true) {
data = new byte[1024];
dataSize = client.Receive(data);
if (dataSize == 0)
break;
Console.WriteLine(Encoding.ASCII.GetString(data,0, dataSize));
client.Send(data, dataSize, SocketFlags.None);
}
client.Close();
server.Close();
Note that this code assume you use Sockets for making the connection.