🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #5019

Re: TCustomWinSocket

#5019
From: Remy Lebeau (TeamB)
Date: Fri, 28 Oct 2005 20:39
34 lines
2175 bytes
"Robert G. Hoover" <not.a.real.address@anywhere.sorry> wrote in message
news:43627188@newsgroups.borland.com...

> I've traced this lag to "whatever happens after
TCustomWinSocket::SendBuf()".

SendBuf() calls the winsock API send() function.  By default, a socket will
buffer outgoing data and not send it immediately.  This allows the socket to
send efficient packets.  This is known as "send coalescing", also known as
the Nagle algorithm.  Have a look at the socket API setsockopt() function
for details on the TCP_NODELAY option.

> I tried to call Application->ProcessMessages() to force windows
> to process the sending event immediately, but it had no effect.
> My assumption is that the SendBuf command posts the event
> message to Windows

Your assumptions is not correct.  Socket writes do not use window messages
at all.  Calling ProcessMessages() has no effect on an outgoing socket
transmission, other than to slow down the code that surrounds the writing.

> Windows doesn't get around to actually sending bytes across the
> LAN cable for 2 seconds.

That is a very likely possibility.

> Is there a way to kick Windows in the pants to process my event
> immediately?

See above.


Gambit
Technical Details
Message-ID: <43628c88$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.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
References: <43627188@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,ddf88f1d3aecd366
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <43627188@newsgroups.borland.com>
Subject: Re: TCustomWinSocket
Date: Fri, 28 Oct 2005 13:39:21 -0700
Lines: 36
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 68.69.17.41
Message-ID: <43628c88$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1130531976 68.69.17.41 (28 Oct 2005 13:39:36 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.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