Article View: borland.public.cppbuilder.internet.socket
Article #3377Re: TServerSocket sends a unwanted acknowlege
From: Hans Galema
Date: Wed, 21 Sep 2005 12:28
Date: Wed, 21 Sep 2005 12:28
37 lines
2704 bytes
2704 bytes
Billy Holliday wrote:
>>Socket error 4 ? Where ? Does the client display that ? Never
>>saw a TServerSocket with that error number.
>>
> I see it on a debug memo and in the protokoll analyser.
>
> void __fastcall TForm::ServerSocketClientError( TObject *Sender,
> TCustomWinSocket *Socket, TErrorEvent ErrorEvent, int &ErrorCode )
> {
> Memo1->Lines->Add("Socket-Error at Port:" + IntToStr( Socket->RemotePort)
> + " Nr.: "+ IntToStr( (int) (ErrorEvent)) );
> ErrorCode= 0;
> }
Aha you get a 4 because you cast a TErrorEvent to an int.
Change your code to use ErrorCode:
Memo1->Lines->Add("Socket-Error at Port:" + IntToStr( Socket->RemotePort)
+ " Nr.: "+ IntToStr( ErrorCode) );
> The client makes a correct response, but the TServerSocket rises a
> Clienterror, because the sequence number is wrong.
Please tell what the real ErrorCode is.
> Perhaps i should try the INDY TCP componente, but i don't know, how to get
> the lenght of the received data message
You are aware that the code you posted for receiving and sending
is not full proof ? Better code has often been posted.
For instance you do not check the returnvalue of SendText().
Further it happens that ReceiveLength() is less than 1. You
are not checking for that scenario.
Hans.
Technical Details
Message-ID:
<433151a9$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!feed6.newsreader.com!newsreader.com!news-out1.kabelfoon.nl!newsfeed.kabelfoon.nl!xindi.nntp.kabelfoon.nl!194.25.134.62.MISMATCH!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<433101e8@newsgroups.borland.com> <43310420$1@newsgroups.borland.com> <433113a8$1@newsgroups.borland.com> <433116ec@newsgroups.borland.com> <43311dc7$1@newsgroups.borland.com> <4331319f$1@newsgroups.borland.com> <43313d37@newsgroups.borland.com> <43313ee1$1@newsgroups.borland.com> <4331460b$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,2e35895317a3987d X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Wed, 21 Sep 2005 14:28:23 +0200 From: Hans Galema <notused@notused.nl> User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.internet.socket Subject: Re: TServerSocket sends a unwanted acknowlege References: <433101e8@newsgroups.borland.com> <43310420$1@newsgroups.borland.com> <433113a8$1@newsgroups.borland.com> <433116ec@newsgroups.borland.com> <43311dc7$1@newsgroups.borland.com> <4331319f$1@newsgroups.borland.com> <43313d37@newsgroups.borland.com> <43313ee1$1@newsgroups.borland.com> <4331460b$1@newsgroups.borland.com> In-Reply-To: <4331460b$1@newsgroups.borland.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 145.98.201.248 Message-ID: <433151a9$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1127305641 145.98.201.248 (21 Sep 2005 05:27:21 -0700) Lines: 37 Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!feed6.newsreader.com!newsreader.com!news-out1.kabelfoon.nl!newsfeed.kabelfoon.nl!xindi.nntp.kabelfoon.nl!194.25.134.62.MISMATCH!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail