Article View: borland.public.cppbuilder.internet.socket
Article #3856Re: TWinSocketStream->Write / Read questions
From: Guenter Stubbe
Date: Wed, 08 Jun 2005 09:05
Date: Wed, 08 Jun 2005 09:05
53 lines
2657 bytes
2657 bytes
Bob Gonder schrieb: > Guenter Stubbe wrote: > > >>I have questions according to the usage of TWinSocketStream. >>If I call the Write method two or more times successively, not all data >>is transfered (in my application). If I code a Sleep(50) between them, >>the transfer works. Why? What is a good value for the Sleep? > > > What timeout value are you giving Write, and how big is your buffer, > and how fast is your connection ? > See the TimeOut property. > The first question is obsolete, becaus with the hint from Remy Lebeau I found the Write works without the Sleep. I have made an error in parsing the buffer ... > >>In the german help there is a hint, that the WaitForData method should >>be called always, if a Read or Write method is called afterwards: > > > Yes, should do so. It doesn't sound like Wait waits for write > completion (Write does that), just waits for the socket to be ready to > send. > > Ok. >>What is a usual size for packets written or read via TWinSocketStream? >>I have no idea and need a starting point. > > > What's best depends on your connection speed. > I would probably set the buffer size to 1/2 the timeout value, or the > timeout to twice the max buffer size (as adjusted by the expected > connection rate). And, again, as adjusted by human factors. I don't > want the timeout so large that the user thinks I locked up. And, I > don't want the timeout so small that the user can't possibly notice > it. > I expect the size of the buffer is in byte and the timeout value in ms. Thank you very much for your help.
Technical Details
Message-ID:
<42a6b4f6$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<42a475d3$1@newsgroups.borland.com> <ceu8a1tk32tsb1i6o443jk54gk1fb320cl@4ax.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,4f2a9ddd9f75b2b X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Wed, 08 Jun 2005 11:05:59 +0200 From: Guenter Stubbe <no-spam@no.spam.com> User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: de-DE, de, en-us, en MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.internet.socket Subject: Re: TWinSocketStream->Write / Read questions References: <42a475d3$1@newsgroups.borland.com> <ceu8a1tk32tsb1i6o443jk54gk1fb320cl@4ax.com> In-Reply-To: <ceu8a1tk32tsb1i6o443jk54gk1fb320cl@4ax.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 84.129.205.236 Message-ID: <42a6b4f6$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1118221558 84.129.205.236 (8 Jun 2005 02:05:58 -0700) Lines: 53 Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail