🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #3849

Re: TWinSocketStream->Write / Read questions

#3849
From: Bob Gonder
Date: Mon, 06 Jun 2005 17:04
28 lines
2223 bytes
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.

>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.

>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.
Technical Details
Message-ID: <ceu8a1tk32tsb1i6o443jk54gk1fb320cl@4ax.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!feed.news.schlund.de!schlund.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <42a475d3$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,4f2a9ddd9f75b2b
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: Bob Gonder <notbg@notmindspring.invalid>
Newsgroups: borland.public.cppbuilder.internet.socket
Subject: Re: TWinSocketStream->Write / Read questions
Date: Mon, 06 Jun 2005 10:04:55 -0700
Organization: MindSpring Enterprises, Inc.
Reply-To: notbg@notmindspring.invalid
Message-ID: <ceu8a1tk32tsb1i6o443jk54gk1fb320cl@4ax.com>
References: <42a475d3$1@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.93/32.576 English (American)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 67.77.154.21
X-Trace: newsgroups.borland.com 1118077493 67.77.154.21 (6 Jun 2005 10:04:53 -0700)
Lines: 32
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!feed.news.schlund.de!schlund.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail