Article View: borland.public.cppbuilder.internet.socket
Article #2964Re: TWinSocketStream Read in BYTE buffer
From: newsgroups.borland.com
Date: Fri, 30 Dec 2005 21:43
Date: Fri, 30 Dec 2005 21:43
41 lines
2703 bytes
2703 bytes
Guys, it works!!
> but you seem to be ignoring them completely.
My bad, I am not ignoring them it's just that I somewhat misunderstood your
directions.
> Here is a more complete code snippet for you:
Thanks, the extra code really helped fill in the gap
> I am incrementing the pointer to the data, not appending the number to the
> data itself. The pointer is incremented to point to a new memory location
> inside the Buffer.
Oh, I interpreted it the way an int variable is incremented by '+=', as in
int a; a += 1; Again, my mis-understanding.
Also, I discovered an error in the code that caused files sent over to the
server to be pre-padded with 'blank' bytes equal to the original file/data
size over. So a file that is 192 Bytes on the client become 384 Bytes on
the server. The error is where you pre-initialized the size of FS to the
size of the data sent over. As in:
ReadFile(TWinSocketStream *Stream, AnsiString &FileName)
{
......
try
{
TFileStream *FS = new TFileStream(fn, fmCreate);
try
{
FS->Size = size; <- Problem here
....
}
Once I commented out the line, it worked perfectly!!
Gambit, I want to thank you again for your time and effort on this one ...
again, your help really got me out of a ditch. The same goes for Jonathan
and Hans, your insights help me better grasp how the data is managed and
sent.
Technical Details
Message-ID:
<43b5a868$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news4.google.com!newshub.sdsu.edu!peer01.west.cox.net!cox.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<43ac3d34$1@newsgroups.borland.com> <43ac6028$1@newsgroups.borland.com> <43acc4c5$1@newsgroups.borland.com> <43ae5b51$1@newsgroups.borland.com> <43aeebe1$1@newsgroups.borland.com> <43aef70e$1@newsgroups.borland.com> <43af06d7$1@newsgroups.borland.com> <43b252fa$1@newsgroups.borland.com> <43b43a5a$1@newsgroups.borland.com> <43b45550$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,74cdc31c66b3abd9 X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit From: "newsgroups.borland.com" <mauriceanderson@hotmail.com> Newsgroups: borland.public.cppbuilder.internet.socket References: <43ac3d34$1@newsgroups.borland.com> <43ac6028$1@newsgroups.borland.com> <43acc4c5$1@newsgroups.borland.com> <43ae5b51$1@newsgroups.borland.com> <43aeebe1$1@newsgroups.borland.com> <43aef70e$1@newsgroups.borland.com> <43af06d7$1@newsgroups.borland.com> <43b252fa$1@newsgroups.borland.com> <43b43a5a$1@newsgroups.borland.com> <43b45550$1@newsgroups.borland.com> Subject: Re: TWinSocketStream Read in BYTE buffer Date: Fri, 30 Dec 2005 13:43:12 -0800 Lines: 43 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 64.30.203.223 Message-ID: <43b5a868$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1135978600 64.30.203.223 (30 Dec 2005 13:36:40 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news4.google.com!newshub.sdsu.edu!peer01.west.cox.net!cox.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail