I need to read some files to send them with Tcp.
Since I want the ability to send them regardless of their size I need to read them in chunks and send them one by one.
I'd prefer to read them asynchronously (or in a dedicated thread) so I don't freeze the app (Console).
The method to send is this:
private void Send(byte[] data, Client client)
{
//0 is the offset
client.SendAsync(data, 0, file.Length);
}
How can I implement this?
And after what size should I chunk the file?