This is a totally different question isn't it?
First of all, what makes you thing it's too slow, what are your
expectations, how are you measuring things. Second, why don't you use what
is provided by Windows, that is, a network connection to a remote share that
can be used to copy files back and forth?
Two diffrent resources are involved when transfering (disk) file data from
one system to another over a network connection: a Disk resource (at both
ends) and the Network.
In general, the network is the slowest then comes the disk (write side), so
instead of trying to optimize the disk reading/writing you should start
looking at the network part.
What kind of connection do you have, what's the topology what's his speed?
What kind of transport protocol are you using? And how are you accessing it
from the application level (Sockets, Named pipes other). How about the
buffer sizes. And last but not least, what (and how) did you measured as
transfer rate?
Willy.
"Chi" <a@a.con> wrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
| Then , what will increase the speed?
| Because I change my code from synchronous to Asynchronous but the speed
| is slower than before.
|
| My code is just sending file between two computer but it will open more
| than 1 network stream and filestream to read write.
|
| Now,I use fs.seek to locate different entry point to read write.
| any suggestion? Thank
|
| Willy Denoyette [MVP] wrote:
| > Did you actually read the document? It clearly states how you can
| > pre-allocate file space.
| >
| > FileStream fs = new FileStream(fileName, FileMode.OpenOrCreate);
| >
| > fs.SetLength(128 * 1024 * 1024);
| >
| >
| >
| > But take care, don't expect it to be 'MUCH faster", it wont even be
'faster'
| > on a reasonable fragmented disk (few fragments).
| >
| >
| >
| > Willy.
| >
| >
| >
| >
| > "Chi" <a@a.con> wrote in message
| > news:%2****************@TK2MSFTNGP04.phx.gbl...
| > | According this
| > |
http://research.microsoft.com/resear...aspx?tr_id=841
| > |
| > | said, if you pre-allocation space for writing , it will be much
faster,
| > | but how can i do this?
| > | Thank
| >
| >