🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: TServerSocket SendText Exception

#2382
From: Bob Gonder
Date: Thu, 20 Apr 2006 18:36
23 lines
2255 bytes
Eric Patterson wrote:

>That is all fine but why?  I would love to fix my issue but I am not a 
>person to shoot shotguns in the dark and hope to hit the target.  If what 
>you have gave me before will fix it then someone here should be able to tell 
>me why that will fix it.  What causes the invalid pointer exception?  Why 
>did this work in NT and now it doesn't in XP?  Please tell me the reason why 
>I have this problem instead of telling me your way will fix it.  Thanks.

Remy explained the "why" in the same message where he explained the
"correct" way to do it.
In short:
	If SendText() fails to send the entire amount (due to a slow
network perhaps, or a smaller packet size on the XP machine), then you
are resending the entire string again, and again, and again...

>> while(Server->ServerSocket1->Socket->Connections[ii]->SendText(AnsiString(AM
>> sg+"\n"))==-1)

In addition to that, you are creating and destroying a temporary
AnsiString each time, which may or may not be a further problem (but,
if you follow Remy's solution, this particular "problem" would also go
away.)
Technical Details
Message-ID: <4mkf429644ao82ak653gcltqtf4v2g698j@4ax.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news3.google.com!border1.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: <44439c71$1@newsgroups.borland.com> <4443ca2a$1@newsgroups.borland.com> <4447a6f6$1@newsgroups.borland.com> <4447b917$3@newsgroups.borland.com> <4447c0b0$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,fea0b13af0f4efa8
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: TServerSocket SendText Exception
Date: Thu, 20 Apr 2006 11:36:23 -0700
Organization: MindSpring Enterprises, Inc.
Reply-To: notbg@notmindspring.invalid
Message-ID: <4mkf429644ao82ak653gcltqtf4v2g698j@4ax.com>
References: <44439c71$1@newsgroups.borland.com> <4443ca2a$1@newsgroups.borland.com> <4447a6f6$1@newsgroups.borland.com> <4447b917$3@newsgroups.borland.com> <4447c0b0$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: 4.246.201.87
X-Trace: newsgroups.borland.com 1145558182 4.246.201.87 (20 Apr 2006 11:36:22 -0700)
Lines: 26
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news3.google.com!border1.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