🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: TServerSocket sends a unwanted acknowlege

#3465
From: Remy Lebeau (TeamB)
Date: Wed, 21 Sep 2005 06:57
62 lines
3955 bytes
"Billy Holliday" <NoSpam@Hohoho.com> wrote in message
news:433101e8@newsgroups.borland.com...

> Sometimes the TCP/IP send a ACKnowlage packege with
> data length zero by himself.
> (I see it on a package analyser..)

What you describe should only be occuring at a lower level of the network
architecture, if at all.  You do not need to concern yourself with it.

> But the client checks the first resonse (zero bytes) and has a problem.

There is no such packet being sent at the application level, nor should it
be received at the application level, either.  Your cliet should only be
receiving data that you have explicitally sent in your own code.

> I only want to send my special response, no other....

That is exactly what should already be happening.  Every TCP project I have
ever seen and/or written has worked that way as expected on every system it
is run on.

> Sometimes the client is sending a data package. The TServerSocket
> received it and send's a response. But the response wasn't send
> over ethernet line.

That is possible, and likely.  See below.

> Than a timeout on the client reached (2 secondes later) and a
> second data package was send. The TServerSocked received
> the data and send a second answer packed.
>
> Now is this:  over the ethernet line, ONE packed was send,
> containing both resonses (2 * 19 bytes)...

That is quite possible, and to be expected since you are sending very small
packets.  By default, a socket will internally buffer all outgoing data and
send it over the connection only when a sufficient amount of data has been
buffered to warrant an efficient transmission.  This is known as "send
coalescing", also known as the "Nagle algorithm".  You can use setsockopt()
to disable it so that small packets are transmitted immediately, though it
may cause performance hits to do so.  According to MSDN:

    "The TCP_NODELAY option is specific to TCP/IP service providers.
Enabling the TCP_NODELAY option disables the TCP Nagle Algorithm (and vice
versa). The Nagle algorithm (described in RFC 896) is very effective in
reducing the number of small packets sent by a host by essentially buffering
send data if there is unacknowledged data already "in flight" or until a
full-size packet can be sent. It is highly recommended that TCP/IP service
providers enable the Nagle Algorithm by default, and for the vast majority
of application protocols the Nagle Algorithm can deliver significant
performance enhancements. However, for some applications this algorithm can
impede performance, and TCP_NODELAY can be used to turn it off. These are
applications where many small messages are sent, which need to be received
by the peer with the time delays between the messages maintained.
Application writers should not set TCP_NODELAY unless the impact of doing so
is well-understood and desired, since setting TCP_NODELAY can have a
significant negative impact of network and application performance."


Gambit
Technical Details
Message-ID: <43310420$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <433101e8@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,2e35895317a3987d,start
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <433101e8@newsgroups.borland.com>
Subject: Re: TServerSocket sends a unwanted acknowlege
Date: Tue, 20 Sep 2005 23:57:05 -0700
Lines: 64
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: <43310420$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1127285792 68.69.17.41 (20 Sep 2005 23:56:32 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail