Article View: borland.public.cppbuilder.internet.socket
Article #2383Re: TServerSocket SendText Exception
From: Eric Patterson
Date: Thu, 20 Apr 2006 18:53
Date: Thu, 20 Apr 2006 18:53
41 lines
2931 bytes
2931 bytes
Thank you. I did do the change and I am getting different problems now which I am trying to fix but if SendText doesn't send the entire amount and I fill the socket buffer wouldn't it call the ServerSocket OnError event? My network is a 10/100 hub which is sitting right on top of the computer and another computer sitting next to it (they are the only two items on the hub) so I don't think speed is an issue. Did XP shrink it default packet size versus what they had on NT? Thanks again. Eric "Bob Gonder" <notbg@notmindspring.invalid> wrote in message news:4mkf429644ao82ak653gcltqtf4v2g698j@4ax.com... > 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:
<4447d8b4$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news4.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-mailReferences:
<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> <4mkf429644ao82ak653gcltqtf4v2g698j@4ax.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: "Eric Patterson" <eric.patterson@bepco.com> Newsgroups: borland.public.cppbuilder.internet.socket 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> <4mkf429644ao82ak653gcltqtf4v2g698j@4ax.com> Subject: Re: TServerSocket SendText Exception Date: Thu, 20 Apr 2006 14:53:41 -0400 Lines: 43 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2869 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 NNTP-Posting-Host: 70.225.107.130 Message-ID: <4447d8b4$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1145559220 70.225.107.130 (20 Apr 2006 11:53:40 -0700) Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.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