BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

File transfert using Winsock2 and TFileStream

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Winsock
View previous topic :: View next topic  
Author Message
Vince
Guest





PostPosted: Thu Dec 18, 2003 1:21 pm    Post subject: File transfert using Winsock2 and TFileStream Reply with quote



Hye all !

I'm writing a file transfert applicatio based on Winsock2.
I use "home made @work Wink" socket implementation classes using TCP, this is
the reason why I can't put source code here :-/
In the client app, I use TFileStream to get a buffer of 8Ko. I compress it
using Zip algorythm, so the the data size is equal or less than the initial
buffer size.
I send the compressed data packet to the server app. Data are received and
decompressed and reassembled by a TFileStream.
During this processus, should I check the CRC's ? (like client's file CRC
regarding of server received file CRC or like sended data packet CRC
regarding received packet CRC...)
Or is it directly encapsulated in the winsock API ?
Are we sure that the packet are received in the same order than they've send
using winsock2 ?
So I'm interessed by everething looking like TCP fie transfert using
Winsock...

Thanks a lot for reading my too bad english.

Vince



Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Thu Dec 18, 2003 7:14 pm    Post subject: Re: File transfert using Winsock2 and TFileStream Reply with quote




"Vince" <forum (AT) bp2k (DOT) net> wrote

Quote:
During this processus, should I check the CRC's ? (like client's
file CRC regarding of server received file CRC or like sended
data packet CRC regarding received packet CRC...)

Unless you are sending the data in pieces, and each piece has its own CRC,
you would have to wait until you had collected enough data to perform
correct CRC checking.

Quote:
Or is it directly encapsulated in the winsock API ?

No. SinSock has no concept of CRC, or any other data you send.

Quote:
Are we sure that the packet are received in the same order
than they've send using winsock2 ?

If you are using TCP, then yes.

Quote:
So I'm interessed by everething looking like TCP fie transfert
using Winsock...

TCP is just a byte stream, there is nothing special about sending files
specifically, they are just more arbitrary blocks of memory as far as it is
concerned. Where the data is coming from in your code, or where it is being
stored to on the receiving end, it does not care.


Gambit



Back to top
Mike Quinn
Guest





PostPosted: Fri Jan 02, 2004 5:43 pm    Post subject: Re: File transfert using Winsock2 and TFileStream Reply with quote



Just a note about transferring files using TFileStream and TCP. If
the connection is broken during the transfer, the last buffer received
is corrupt (in my experiance). If the connection stops because of a
disconnect before you receive the complete file, cut the file stream
back by the buffer size (8000 bytes by Indy default) so that the file
can be resumed on the next attempt. The resume is something you may
or may not want to put in but if you do need that functionality,
cutting back the partial file receive will allow you to start right
back up at the file size position the next time.

Thanx,
-q
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Winsock All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.