Hey there, i am currently working at a program that transfer files via FTP. I send the files in binary because with ASCII I can´t send special characters.
Here is my currently code :
using(BinaryReader bReader = new BinaryReader(srcStream))
using (BinaryWriter bWriter = new BinaryWriter(destStream))
{
Byte[] readBytes = new Byte[1024];
for(int i = 0; i < bReader.BaseStream.Length; i += 1024)
{
readBytes = bReader.ReadBytes(1024);
bWriter.Write(readBytes);
}
}
My Problems with this code are :
- It works really slow, is there a way to optimize ?
- The way i ask for EOF(EndOfFile) seems to be very strange, is there another elegance option ?
Thanks alot :D