Article View: borland.public.cppbuilder.internet.socket
Article #2940Re: TWinSocketStream Read in BYTE buffer
From: Maurice Anderson
Date: Sat, 24 Dec 2005 03:48
Date: Sat, 24 Dec 2005 03:48
32 lines
2028 bytes
2028 bytes
Thanks for the reply Remy, but I am a little confused on some things:
Is ReadBuf the function in the server thread to read data from the client?
Is WriteBuf also meant to bein the server thread to write the contents of
the buffer into a new file name?
> I strongly recommend that you send the file size along with the file data
so that the receiver knows ahead
of time how much data to expect.
How do I send the byte ahead of time when I launch the server thread? As in
SocketThread = new TMyServerThread(true,ClientSocket);?
I have something like this in the server thread's Execute method:
TWinSocketStream* str = new TWinSocketStream(ClientSocket, timeout);
while( (!Terminated) && (ClientSocket->Connected) )
{
if (str->WaitForData(6000))
{
if( ReadBuf(str, &datasize, sizeof(int)) )
{
//....
}
}
}
delete str;
I am sorry, I am still somewhat totally confused on what to do.
Sorry ... Thanks
Technical Details
Message-ID:
<43acc4c5$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!news-out.newsfeeds.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<43ac3d34$1@newsgroups.borland.com> <43ac6028$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: "Maurice Anderson" <mauriceanderson@hotmail.com> Newsgroups: borland.public.cppbuilder.internet.socket References: <43ac3d34$1@newsgroups.borland.com> <43ac6028$1@newsgroups.borland.com> Subject: Re: TWinSocketStream Read in BYTE buffer Date: Fri, 23 Dec 2005 19:48:01 -0800 Lines: 35 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 NNTP-Posting-Host: 64.30.203.223 Message-ID: <43acc4c5$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1135396037 64.30.203.223 (23 Dec 2005 19:47:17 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!news-out.newsfeeds.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail