🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

TServerSocket sends a unwanted acknowlege

#3466
From: Billy Holliday
Date: Wed, 21 Sep 2005 06:48
58 lines
2822 bytes
Hello.

I have two problem with TServerSocket component.

I want to have a easy TCP/IP - port connection with a client.
If the client send a data package, i want to send a special response to this
data package.
I do this in the event:
ServerSocketClientRead( TObject *Sender, TCustomWinSocket *Socket )
{
    count = Socket->ReceiveLength ();  // checking how much bytes received
    unsigned char   Buff[5000];  // make a big buffer
    Socket->ReceiveBuf ( Buff, count );  // read the data

   // processing the data..

  char response[20];  // sendbuffer

  // building the response, terminated with 0x00

   Socket->SendText(response);  // send the response (19 Bytes)
}


Now the two problems:

Sometimes the TCP/IP send a ACKnowlage packege with data length zero by
himself.
(I see it on a package analyser..)
After this, the really response, send with the SendText methode, reveived.

But the client checks the first resonse (zero bytes) and has a problem. (I
can't change the client !)

Can i switch off the automativ send of a ACK with zero bytes. I think, it
was send by the tcp/ip stack automatically.   rightly ?
I only want to send my special response, no other....


The second problem is:
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.
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)...

Why is this? I think the TServerSocket has time enougt to send the first
response.....
A   Application->ProcessMessages() after Socket->SendText(response);
doesn't resolve the problem.

How can i make sure, the response packed is send immediate

Please help me...
thanks.
Technical Details
Message-ID: <433101e8@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.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

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,2e35895317a3987d
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Billy Holliday" <NoSpam@Hohoho.com>
Newsgroups: borland.public.cppbuilder.internet.socket
Subject: TServerSocket sends a unwanted acknowlege
Date: Wed, 21 Sep 2005 08:48:38 +0200
Lines: 61
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4927.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4927.1200
NNTP-Posting-Host: 212.202.128.58
Message-ID: <433101e8@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1127285224 212.202.128.58 (20 Sep 2005 23:47:04 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.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