|
-
Nov 19th, 2002, 01:29 PM
#1
Thread Starter
Lively Member
Asynchronous File Transfer
I have a few questions about a file transfer client/server app I'm writing. I can set up the socket connection between them, and get a network stream where I can send text messages back and forth using asynchronous Send and Receive (BeginSend and BeginReceive) and using callbacks, now here's my question...
I've never done file transfer before, and I noticed that .NET has a FileStream object that I'd like to use. But I need to know if I should do asynchronous or syncrhonous writing to the file.
My head just gets confused trying to imagine the flow of the program because I'd be doing a BeginRead from the socket connection that fills up the buffer, once that is full the callback would need to write that buffer full of data to a file. Should I just do a synchronous FileStream.Write to a file then go back to getting another buffer full of file from the network stream? Or should I use a FileStream.BeginWrite to write the data to the file and implement a callback that would fetch another buffer full from the network stream. I'm just curious what the performance benefits are.
Thanks in advance,
Jacob438
-
Nov 19th, 2002, 01:44 PM
#2
Thread Starter
Lively Member
if you want to see what my code is based on, here's something similar to what I'm doing (except I'll be sending receiving viles instead of trivial text messages)...
http://msdn.microsoft.com/library/de...ientsocket.asp
Thanks,
Jacob438
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|