Article View: borland.public.cppbuilder.nativeapi
Article #14772Re: BCB TCP IP component
From: Hans Galema
Date: Sat, 02 Aug 2003 07:28
Date: Sat, 02 Aug 2003 07:28
43 lines
2710 bytes
2710 bytes
Chris wrote:
> I didn't think it could be too long, but it can be too short if the client
> disconnects in the middle of a transfer, right?
Yes, but then you have not a normal connection.
During a normal connection every byte should be delivered.
> Plus if I send the header and then the data to the header in different calls
> to sendbuf, would I risk retrieving other information in the middle of the
> calls, which would be fatal?
No. Because you will (if you do it the right way) only retrieve bytes
which are received by the receiving socket and where the socket
told you that there were bytes to read for you. (this is with
a non blocking socket).
You can send first the size (4 bytes) then the header and then the data,
all with different calls to SendBuf. The data on its own will probably
need more than one call and of cource you have to check the returnvalue of
SendBuf().
int size = sizeof(size) + sizeof(header) + sizeof(data);
int size = sizeof(header) + sizeof(data);
// choose one of these possibilities
->SendBuf ( &size, sizeof(size) );
->SendBuf ( &header, sizeof(header) );
->SendBuf ( &data, sizeof(data) );
> If I didn't do that, I would have to combine
> the messages and that would be extremely slow since the messages are huge.
You don't have to.
> It's on a 100mb network, so I get about 50k per
?? Broken message.
WOuld the speed of a network influence the chuncks ?
Hans.
Technical Details
Message-ID:
<3f2b67c8@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-01!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<3f29cebd$1@newsgroups.borland.com> <3f29d94d@newsgroups.borland.com> <3f29dd02$1@newsgroups.borland.com> <3f2a3040$1@newsgroups.borland.com> <3f2b2934$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,9e6acf8dd63da257 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-08-02 00:34:25 PST Date: Sat, 02 Aug 2003 09:28:16 +0200 From: Hans Galema <j.m.galema.dontusethis@maartens.nl> User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.3.1) Gecko/20030425 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: BCB TCP IP component References: <3f29cebd$1@newsgroups.borland.com> <3f29d94d@newsgroups.borland.com> <3f29dd02$1@newsgroups.borland.com> <3f2a3040$1@newsgroups.borland.com> <3f2b2934$1@newsgroups.borland.com> In-Reply-To: <3f2b2934$1@newsgroups.borland.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 129.125.108.11 Message-ID: <3f2b67c8@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1059809224 129.125.108.11 (2 Aug 2003 00:27:04 -0700) Lines: 44 Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-01!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail