Fishing for Ideas (C# file copy)
-
From time to time I would like to have the ability to copy a file through the network to some of our remote locations but control the bandwidth because they have much slower connections. I've used nullsoft's nscopy before, but figured this would be a good learning expierence if I could create my own app to be more fine tuned to my environment. I have a general idea of what I need to do, but am not sure where to start. Looking at the system.IO.file.copy method it doesn't look like there's an overload that controls bandwidth. Then I started to think maybe I need to take the file and create a file stream and pass that through the network somehow, but that's where I get stuck. Has anyone tried doing something like this before? I'm just looking for a nudge in the right direction. Thanks!
"You're damned if you do, and you're damned if you dont" - Bart Simpson
-
From time to time I would like to have the ability to copy a file through the network to some of our remote locations but control the bandwidth because they have much slower connections. I've used nullsoft's nscopy before, but figured this would be a good learning expierence if I could create my own app to be more fine tuned to my environment. I have a general idea of what I need to do, but am not sure where to start. Looking at the system.IO.file.copy method it doesn't look like there's an overload that controls bandwidth. Then I started to think maybe I need to take the file and create a file stream and pass that through the network somehow, but that's where I get stuck. Has anyone tried doing something like this before? I'm just looking for a nudge in the right direction. Thanks!
"You're damned if you do, and you're damned if you dont" - Bart Simpson
You're already moving in the right direction :thumbsup: You'd indeed start out with a streamreader and a streamwriter. Instead of filling the stream at once, fill it block by block of data. This will result in a read/write loop that you can throttle if desired. There's a handy sheet-cheat here[^].
I are troll :)
-
You're already moving in the right direction :thumbsup: You'd indeed start out with a streamreader and a streamwriter. Instead of filling the stream at once, fill it block by block of data. This will result in a read/write loop that you can throttle if desired. There's a handy sheet-cheat here[^].
I are troll :)
AH! Thank you very much for the help and the sheet-cheat eddy! I continued to get stuck because I was aproaching the task thinking I could handle the bandwidth speed from the network side and not the stream reader!
"You're damned if you do, and you're damned if you dont" - Bart Simpson
-
AH! Thank you very much for the help and the sheet-cheat eddy! I continued to get stuck because I was aproaching the task thinking I could handle the bandwidth speed from the network side and not the stream reader!
"You're damned if you do, and you're damned if you dont" - Bart Simpson